more fixes to control-service

This commit is contained in:
2021-05-24 12:19:24 -04:00
parent fe5a2ad113
commit 1d882a7ddc
+3 -3
View File
@@ -318,7 +318,7 @@ Function Control-Service
$StopCmd = $ArgString -replace ' -Restart ', ' -Stop ' $StopCmd = $ArgString -replace ' -Restart ', ' -Stop '
$StartCmd = $ArgString -replace ' -Restart ', ' -Start ' $StartCmd = $ArgString -replace ' -Restart ', ' -Start '
Invoke-Expression $StopCmd Invoke-Expression $StopCmd
Start-Sleep -Seconds 10 #Start-Sleep -Seconds 10
Invoke-Expression $StartCmd Invoke-Expression $StartCmd
Exit Exit
} }
@@ -350,11 +350,11 @@ Function Control-Service
LogMsg " ${verbing} ${displayname}" LogMsg " ${verbing} ${displayname}"
Switch ( $verb) { Switch ( $verb) {
'start' { 'start' {
Try { Start-Service -Name $svc } Try { Start-Service -Name $name }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
} }
'stop' { 'stop' {
Try { Stop-Service -Name $svc -Force } Try { Stop-Service -Name $name -Force }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
} }
} }