--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


This shows you the differences between two versions of the page.

Link to this comparison view

windowsserviceswontstartautomatically [2013/04/21 10:09] (current)
sjoerd created
Line 1: Line 1:
 += Fix: Windows Services Won't Start Automatically =
 +After rebooting a Windows Server some services that should start automatically are not automatically started. Looking in the event viewer you'll see errors like this:
 +The SQL Server (MSSQLSERVER) service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.
 +A timeout was reached (30000 milliseconds) while waiting for the SQL Server (MSSQLSERVER) service to connect.
 +This error can occur when the system is too busy to start the service within the 30 seconds range. Starting the services is stopped and not retried. According to [[http://​​kbid=884495|this]] MS knowledgebase article this can be solved by configuring a higher timeout:
 +# Click Start -> click Run -> type regedit and click OK.
 +# Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
 +# Right-click Control -> select New -> DWORD Value.
 +# In the New Value #1 box, type ServicesPipeTimeout,​ and press ENTER.
 +# Right-click ServicesPipeTimeout -> Modify.
 +# Click Decimal, type the number of milliseconds that you want to wait until the service times out, and then click OK.
 +## For example, to wait 60 seconds before the service times out, type 60000.
 +# Quit Registry Editor, and then restart the computer.
 +> Note: Rebooting the computer is not strictly necessary, this is a setting that's only valid for reboots so it will be eligible for the next reboot anyway.
 += Using PowerShell To Compare Running Services =
 +If you don't trust the above fix, or if you're still determining how high the timeout should be in your environment you could use powershell to make a list of all running services and then compare that list with a new one afterwards your reboots:
 +<code powershell>​
 +get-content D:​\sjoerd\services\computers.txt | Foreach-Object {get-service -ComputerName $_ | where-object {$_.Status -eq "​Running"​} | Out-File D:​\sjoerd\services\services-before\$_.txt}
 +get-content D:​\sjoerd\services\computers.txt | Foreach-Object {get-service -ComputerName $_ | where-object {$_.Status -eq "​Running"​} | Out-File D:​\sjoerd\services\services-after\$_.txt}
 +get-content D:​\sjoerd\services\computers.txt | Foreach-Object {Compare-Object $(Get-Content D:​\sjoerd\services\services-before\$_.txt) $(Get-Content D:​\sjoerd\services\services-after\$_.txt) | Out-File D:​\sjoerd\services\services-difference\$_.txt}
 +This will need a list of computers you will be rebooting. Run the first line before you do the reboot, and the second and and the third one after you've rebooted. ​
 +You can use this command to create the computers list:
 +<code powershell>​
 +Get-Cluster | Where {$_.Name -match "​Delft"​} | Get-VM | Where {$_.PowerState -eq "​PoweredOn"​} | select Name | sort Name | Format-Table -HideTableHeaders | Out-File D:​\sjoerd\services\computers.txt
 +{{tag>​fix windows scripts}}
windowsserviceswontstartautomatically.txt ยท Last modified: 2013/04/21 10:09 by sjoerd