Windows Server 2003
1753341 Members
4992 Online
108792 Solutions
New Discussion юеВ

Kill a service from the commad line

 
SOLVED
Go to solution
'chris'
Super Advisor

Kill a service from the commad line

hi

Howto kill a service from the commad line that cannot be stopped using Computer Management -> Services?
4 REPLIES 4
Jon Finley
Honored Contributor
Solution

Re: Kill a service from the commad line

Try using PSKill from MS (Sysinternals). It's part of the PSTools set.

http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx

Jon
"Do or do not. There is no try!" - Yoda
P Muralidhar Kini
Honored Contributor

Re: Kill a service from the commad line

Hi Chris,

If its Windows XP then you can make use of the TASKKILL command to kill a
process.
http://www.tech-recipes.com/rx/446/xp_kill_windows_process_command_line_taskkill/

For windows server 2003, you can make use of PSKILL. Its a freeware.
http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx

You can also consider installing Windows server 2003 support tools.
The Support Tools are not automatically installed when you install
Windows 2003 and you find a option for it in the Windows 2003 setup either.
The installation program is located on the CD-ROM in the \support\tools folder
and the setup file (suptools.msi) must be opened manually to initiate the
installation wizard.

It contains many tools, one of which is "Process Viewer". This can be used to
kill a process.

Have a look at the set of tools that are present in the support tools, you may find
some of them very userfull.

Regards,
Murali
Let There Be Rock - AC/DC
Edgar Zapata
Esteemed Contributor

Re: Kill a service from the commad line

Hi Chris,

At the services console (start - run - services.msc) or Computer - Management - Services, general tab you can see what the path to the executable a given service is running on. (Although you only need the executable, not the path).
Once you know what the executable is, you can kill that process.

(Note:
Just keep in mind some service processes don't run in its own dedicated executable.)
Some services might be hosted into one instance of svchost.exe process.
Killing this process will terminate all other processes running into that same svchot.exe image.

Knowing that, you may run kill (attached).
Here's the syntax:

kill -f PID

See, if I were to kill the process for mmc.exe

C:\>tasklist | findstr /i "PID mmc"
Image Name PID Session Name Session# Mem Usage
mmc.exe 5944 RDP-Tcp#300 10 13.168 K

I would have to run the following:
kill -f 5944

You can also see which services are running under the same svchost.exe process through Process Explorer.

Hope it helps.
Michal Kapalka (mikap)
Honored Contributor

Re: Kill a service from the commad line