Pular para o conteúdo principal

Quick Tip: Kill rogue processes with taskkill in Microsoft Windows

Quick Tip: Kill rogue processes with taskkill in Microsoft Windows: "

There are times, regardless of your operating system, when you will need to manually kill a rogue process. Most of the time, this can easily be done with the help of the Microsoft Windows 7 Task Manager. There are times, however, when that tool doesn’t seem to have the ability to kill a rogue process. I have seen this plenty of times when trying to kill an Acronis process that has gone astray. When this happens, I have to employ a more powerful tool, taskkill, which is used from the command line.


This blog post is also available in the PDF format in a TechRepublic Download.


Note: In order to run the taskkill command you will have to have the command window open. To do this click Start | Run and type cmd in the text field or just enter cmd in the Run Dialog (access Run Dialog by clicking Win+R). (Figure A)


Figure A



Start the command window

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic’s Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!


Using taskkill


The general syntax of the command looks like this:


taskkill [OPTIONS] [PID]


As you might expect, there are plenty of options available for this command. Some of the more helpful options are:



  • /s COMPUTER - (Where COMPUTER is the IP or address of a remote computer). The default is the local computer, so if working with a command on the local machine you do not have to use this option.

  • /u DOMAIN\USER - (Where DOMAIN is the domain and USER is the username you authenticate to). This option allows you run taskkill with the account permissions of the specified USERNAME or DOMAIN\USERNAME.

  • /p - If you use the /u option, you will also need to include the /p option which allows you to specify the user password.

  • /fi - Allows you to run the taskkill command with filters.

  • /f - Forces the command to be terminated.

  • /IM - Allows you to use a application name instead of the PID (Process ID number) of the application.


One of the most useful options is the help switch (Figure B):


taskkill /?


Figure B



Help for the taskkill command

Killing with application name


The simplest way to kill a rogue application with taskkill is using the /IM option. This is done like so:


taskkill /IM APPLICATION_NAME


Where APPLICATION_NAME is the name of the application you want to kill. Say, for example, Outlook is refusing to close. To close this with taskkill you would execute the command:


taskkill /IM outlook.exe


Killing with PID


Let’s say you do not know the name of the application, but instead you know the PID of the application. To kill a process with a PID of, say, 572, you would issue the command:


taskkill /PID 572


Killing all processes owned by a particular user


What if you want to kill all processes owned by a single user? This can come in handy if something has gone awry with a user account, the user has logged out, but some of the processes owned by that user will not go away. To manage this you would issue the taskkill command like so:


taskkill /F /FI “USERNAME eq username”


In this case, the username is the actual username that owns the processes. Note: The USERNAME option must be used in order to tell the taskkill command a username will be specified.


Killing processes on a remote machine


This one is very handy. Say something has locked up your desktop and you know exactly what application is the culprit. Let’s stick with our Outlook example from earlier. You can hop onto another machine and remotely kill that application like so:


taskkill /s IP_ADDRESS /u DOMAIN\USERNAME /IM Outlook.exe


Where IP_ADDRESS is the Address of the remote machine (Note: The hostname can be substituted if the machines are able to see one another by hostname), DOMAIN is the domain (if applicable), and USERNAME is the username used to authenticate to the remote machine.


Final thoughts


The ability and power that comes with the taskkill command can be a very valuable tool that might save you from having to forcibly reboot a machine. Having a solid grasp of this tool, in conjunction with using the Windows Task Manager, will help to keep your Windows machines enjoying longer uptime and, should the occasion strike, the ability to manage a task when a virus, rootkit, or trojan has taken over your machine.





"

Comentários

Postagens mais visitadas deste blog

Favigen, Favicon Generator

Favigen, Favicon Generator : " Favicons are small icons that help identify websites. They are used as a visual representation of a website both in the web browser and at many online services. The three most prominent locations of favicons are the browser’s address bar, the tabbar and the bookmarks folder. Many webmasters like to create custom favicons to add that custom identifier to their website. Favicons can be created in many image and icon editors, but also online. Favigen is a straightforward favicon generator that can turn an image into a favicon. All that it takes is to pick an image from the local hard drive first, select the dimensions of the favicon and click the submit button to make the service generate the favicon. Favigen supports several image formats, including jpg and png, and it does not seem to have size restrictions either. Available image dimensions range are 16×16, 32×32 and 64×64. The generated favicon is displayed directly on the page. A click on do...

A simple rsync script to back up your home directory

A simple rsync script to back up your home directory : " Backing up important data is obviously something we should all do. Unfortunately, it is not always easy to make it happen. We get lazy; we do not have the additional hardware for a backup server; it takes a long time and a lot of CDs to back up to optical media; we do not trust online backup services; backup schemes are difficult to set up and use — any of dozens of reasons can stand in our way. Still, we know we should be backing up our important data. Modern open source Unix-like operating systems offer a plethora of options for incredibly simple, effective backup schemes, however. If the problem is figuring out how to set one up, a simple rsync solution may be exactly what you need. The rsync utility is used to synchronize files between two systems. It does so by way of incremental copies, only copying from the source to the destination what has not already been copied there, saving time, network bandwidth, and syst...

Google Wave now open to the public: faster, Robots and Gadgets aplenty!

Google Wave now open to the public: faster, Robots and Gadgets aplenty! : " Filed under: Internet , Google If you somehow missed it, Google Wave is now a bonafide Labs project: rather than being an invite-only alpha, it's now a public beta test! If you don't already have an account, just head on over to Wave and use your regular Google login details. If you've not seen any of the Google Wave introductory videos , you should check them out -- they explain the whole thing a lot more succinctly than I ever could. Wave has also been enabled for Google Apps domains -- businesses could convert their internal communication to Waves today! Leading up to this public release there have a lot of changes. It's by no means finished, but Google Wave is now a lot faster . It's also more intuitive -- more useful -- and given the large number of Robots and Gadgets now reaching prime-time readiness, it feels like the mass adoption of Wave is imminent. Also, if you're an ol...