more fixes to control-service
This commit is contained in:
@@ -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 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user