Monday, April 9, 2012

How to force certain windows services to start first (or otherwise)


Basically, this article will enable us to hard-code the sequence of service start-up. It will be useful in some situations.



Summary:
  1. Locate relevant "Service" registry key
  2. Right click -> New -> Multi-string Value
  3. Type "DependOnService", press ENTER
  4. In value data box, type , click OK
  5. Restart the computer
Full gory details follow:
http://support.microsoft.com/kb/193888
The Registry subkeys for services are located in the following path and can control how services are loaded.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
To create a new dependency, select the subkey representing the service you want to delay, click Edit, and then click Add Value. Create a new value name "DependOnService" (without the quotation marks) with a data type of REG_MULTI_SZ, and then click OK. When the Data dialog box appears, type the name or names of the services that you prefer to start before this service with one entry for each line, and then click OK

The name of the service you would enter in the Data dialog box is the exact name of the service as it appears in the registry under the Services key. 

When the computer starts, it uses this entry to verify that the service or services listed in this value are started before attempting to start the dependent service. 


In addition, Windows 2000 and Windows 2003 Active Directory needs to find and use the DNS Server service. The Netlogon service can be delayed to ensure that the DNS Server service is up and running for Dynamic DNS registration and query for existing Active Directory domain controllers that are in the DNS server database. Use the DependOnService in the Netlogon and add DNS to the list of LanmanWorkstation and LanmanServer. This delays Netlogon from starting until the DNS Server service on that same computer is started and ready. 

Note Only delay the Netlogon service for DNS on a Windows 2000 or Windows 2003 Server when the DNS service is on the same Windows 2000 or Windows 2003-based server. 

Note Entries in this field are NOT case-sensitive. 

Warning Adding this entry manually may prevent the system from starting properly if you establish a "circular dependency." In its simplest form, such a problem would occur when you make two differing services dependent on one another. Neither service would be able to start as they would both require the other to be started first.

Note If you have a service that needs to start late in the boot cycle but you do not have a specific service dependency, as explained above, then choose one of the services which startup last as the data value for the value "Depends on Service". Services commonly selected are Spooler and Messenger.