General discussion

Locked

Disable Services at Command Line

By Black-eyed Pea ·
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?

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by matthew-martin In reply to Disable Services at Comma ...

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.

Collapse -

by Black-eyed Pea In reply to

Poster rated this answer. Except for the syntax, that was the answer I was looking for. Thanks.

Collapse -

by p.j.hutchison In reply to Disable Services at Comma ...

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.

Collapse -

by Black-eyed Pea In reply to Disable Services at Comma ...

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 <server> config [service name] <option1> <option2>...
CONFIG OPTIONS:
NOTE: The option name includes the equal sign.
type= <own|share|interact|kernel|filesys|rec|adapt>
start= <boot|system|auto|demand|disabled>
error= <normal|severe|critical|ignore>
binPath= <BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <Dependencies(separated by / (forward slash))>
obj= <AccountName|ObjectName>
DisplayName= <display name>
password= <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.)

Collapse -

The sintax is wrong

by lulia In reply to

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

sc config WSearch start= disabled

Collapse -

by Black-eyed Pea In reply to Disable Services at Comma ...

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.

Collapse -

by Black-eyed Pea In reply to Disable Services at Comma ...

This question was closed by the author

Collapse -

More Details Needed

by Arcomm In reply to Disable Services at Comma ...

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).

Back to Windows Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums