Skip to content
Snippets Groups Projects
Commit 4944a57e authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Only start the service if explicitly requested via a switch.

This is only useful if the package actually contains configuration files
for the given host. If that's the case use the switch, otherwise a
message about how to start it will be printed to the console.
parent 0ead6bb0
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@
#Requires -version 5.1
#Requires -RunAsAdministrator
[CmdletBinding()]
Param(
[Parameter(Mandatory=$False)][switch] $StartService
)
function Start-MyService {
Write-Host -NoNewLine "Starting service $($ServiceName): "
......@@ -97,4 +101,15 @@ if ($Service) {
Copy-ServiceFiles
Install-Service
Start-MyService
Write-Host "`nWatching the service log file can be done like this:`n" `
"`n> Get-Content -Wait -Tail 50 $($ServiceLog)`n"
if ($StartService) {
Start-MyService
} else {
Write-Host "Service installation has completed.`n" `
"`nNOTE: the service has not been started. Create and/or check`n" `
"the configuration files and start the service manually using:`n" `
"`n> Start-Service $($ServiceName)`n"
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment