Discussion Locked

Disable Services at Command Line

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
It would be nice to automate the process of disabling services at initial workstation configuration - perhaps through a .bat or .reg file. Does anyone know how to disable specific Windows services at the command line or through the Windows Registry? If not, what about the Windows Scripting Host?

8 replies

by matthew-martin

Use this command in a batch:
sc config [Service Name] start=disabled

Make sure you use the service name from when you click on it in services not the display name. If you use the display name it won't work.

by p.j.hutchison

You can also use the Recovery console to disable services using the Disable command.

Also the Windows 2000/2003 Resource Kit has a service.vbs which can be used to control services from the command line.

by black-eyed pea

I think that's off to the right start, but the syntax appears to be incorrect. For instance, if I use the command:

sc config Messenger start=disabled

Then I receive the following output:

Modifies a service entry in the registry and Service Database.
SYNTAX:
sc config [service name] ...
CONFIG OPTIONS:
NOTE: The option name includes the equal sign.
type=
start=
error=
binPath=
group=
tag=
depend=
obj=
DisplayName=
password=

So, I attempt to use the computer name:

sc \\[computer name] config Messenger start=disabled

I get the same output. (It would be nice not to have to use the computer name, so a generic workstation setup could be more automated.)

by lulia

Dunno how many ppl stumbled at this, only to discover there is a space betwwen start= and disabled:

sc config WSearch start= disabled

by black-eyed pea

OK. Here is the correct syntax:

sc config "browser" start= disabled
sc config "messenger" start= disabled
sc config "upnphost" start= disabled

Note the space after the '=' symbol. That worked! Thanks.

by arcomm

Thank you to the posters who got us on the right track. However, more details were necessary so here they are...

You need to specify the "ServiceKeyName" on the sc command-line. As pointed out you cannot use the Display Name. The key name is not readily viewable in the list of services (services.msc). But what you can do is run this command to get the key name. I'll use Computer Browser (the display name) as an example:

sc getkeyname "Computer Browser"

It returns:

[SC] GetServiceKeyName SUCCESS
Name = Browser

The 'Name' output is what you need, in this case case 'Browser' which can be used in the syntax provided in the other posts (e.g. sc stop browser).

This discussion is closed to new replies.