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 '
$StartCmd = $ArgString -replace ' -Restart ', ' -Start '
Invoke-Expression $StopCmd
Start-Sleep -Seconds 10
#Start-Sleep -Seconds 10
Invoke-Expression $StartCmd
Exit
}
@@ -350,11 +350,11 @@ Function Control-Service
LogMsg " ${verbing} ${displayname}"
Switch ( $verb) {
'start' {
Try { Start-Service -Name $svc }
Try { Start-Service -Name $name }
Catch { LogErr $_.Exception.Message }
}
'stop' {
Try { Stop-Service -Name $svc -Force }
Try { Stop-Service -Name $name -Force }
Catch { LogErr $_.Exception.Message }
}
}