![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | No timeout for stop-service cmdlet? To perform some testing I have a service that intentionally takes 10 minutes to shut down. When I stop the service from the Services mmc snap-in it eventually times out and gives the error "Error 1053: The service did not respond the start or control request in a timely fashion." This is what I'd expect. However, when I try to stop the service using the stop-service cmdlet it prints out the expected "WARNING: Waiting for service 'MyServiceName' to finish stopping..." for the entire 10 minutes until the service actually exits. It never times out or gives an error that the service might not be responding. My question is two fold. First, is there a way to specify the time out for the stop-service cmdlet so that it gives an error if the service takes too long to shut down or stops responding? Second, am I going about this in the right way? Here's my code: #Verify status of service and stop it if running $serviceInfo = get-service -displayName $serviceName if($serviceInfo.status -eq "Stopped") { "Service is already stopped my friend" exit 0 } stop-service -displayName $serviceName |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| .net Windows Service Won't Start - Timeout | .NET General | |||
| Controlling service restart timeout with WMI | VB Script | |||
| Stop-Service cmdlet | PowerShell | |||
| Windows Service Timeout in Vista | Vista General | |||