Making sure Windows doesn't start your service before SQL Server
This is more of a "note to self" of the syntax, but, if you have a service that depends on another (such as a local SQL Server instance for local logging) then you can tell Windows about that dependency. The command line is:
sc config MyServiceName depend= MSSQLSERVER
- Needs to be run from an administrative command prompt
- Must have the space after the equals symbol
- Uses the service names that are displayed under "Service name:" at the top of the "General" tab if you view the properties of the service in the Services control panel
The name of the SQL Server service can, and will, vary. If you had an instance called BADGER then the name of the service will likely be MSSQL$BADGER, so don't assume the name of the SQL Server service. You can also use this to setup dependencies between any other services you want, it's not limited to SQL Server as it's a piece of general Windows functionality rather than being part of SQL Server.