Monday, May 01, 2006

Tech Tip: Turning off services remotely with Windows

This article applies to Windows Server OS's (Server & Advanced Server 2000, 2003), Windows XP and greater with the Service Controller Query Tool - sc.exe.

sc.exe is contained within the Windows Resource Toolkit. From the Microsoft website:

"The Microsoft® Windows® Server 2003 Resource Kit Tools are a set of tools to help administrators streamline management tasks such as troubleshooting operating system issues, managing Active Directory®, configuring networking and security features, and automating application deployment."

Anyway, what we need is a list of all of the computers on the local network and administrator rights within that domain. To do this, open up the command prompt (Windows-R -> cmd, Start -> Run -> cmd ...) or open the command prompt from the start menu and use the net command to list all available computers.

The usage is:

net view

Then, we need to identify the service name we want to stop. (A useful list of windows services can be obtained through your favourite search engine or here.) Then we do the following (again at the command line):

sc \\hostname stop servicename

where \\hostname is one of the names on the list we got from the net view command. An example would be to remotely stop windows automatic update:

sc \\machine stop wuauserv

The output will look something like the following:

SERVICE_NAME: wuauserv
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 3 STOP_PENDING
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x1
WAIT_HINT : 0x3a98


If you need to do this on your local machine, you can either use the hostname of the machine, or leave out the hostname entirely and it should work. Using localhost, however, does not work...

As always, any questions or comments, feel free to post ;)


1 Comments:

Anonymous Anonymous said...

Thank you for this valuable article. It exatly describes what I needed.
Jiri

7/10/2006 5:10 AM  

Post a Comment

<< Home