SHIFT

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

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

windowsserviceswontstartautomatically

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.

or

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 this MS knowledgebase article this can be solved by configuring a higher timeout:

  1. Click Start → click Run → type regedit and click OK.
  2. Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  3. Right-click Control → select New → DWORD Value.
  4. In the New Value #1 box, type ServicesPipeTimeout, and press ENTER.
  5. Right-click ServicesPipeTimeout → Modify.
  6. Click Decimal, type the number of milliseconds that you want to wait until the service times out, and then click OK.
    1. For example, to wait 60 seconds before the service times out, type 60000.
  7. 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:

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:

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
You could leave a comment if you were logged in.
windowsserviceswontstartautomatically.txt · Last modified: 2021/09/24 00:25 (external edit)