Archive

Posts Tagged ‘service’

Changing a service’s startup policy via CLI

April 16, 2012 Leave a comment

I recently needed to automate an installation of a service but ran into a problem that it was starting automatically by default (which we did not want).

So I found a simple CLI to change this behavior –

reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\my-service-name /v Start /t REG_DWORD /d 3 /f

What it does is:

  1. Go to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\my-service-name entry in the registry
  2. Sets the value of Start (/v Start) to be the 32bit value (/t REG_DWORD) of 3 (/d 3)
  3. It overrides the current value if exists (/f)
All valid values are:
  • 2 = Automatic
  • 3 = Manual
  • 4 = Disabled
I have to give credit to this Microsoft article: http://support.microsoft.com/kb/248660
Advertisements
%d bloggers like this: