Command Line Kung Fu: Remotely uninstall software from the command line

Until that day I am just going to have to settle for removing the game P2P downloader music “player” software you decided (all on your own like a real grown up) that you needed to install on your work computer, but that is actually adware infested spyware infested trojan infested virus ridden specifically prohibited by our company computer use policy.

Oh, you didn’t know I could do that? Yep. Here is just one way that I can wipe out your WoW client bittorrent client kazaa client pr0n dialer newly installed software using WMI.

Step 1: Cut a hole in a box Enter WMIC

  1. Fire up a command prompt as the domain administrator. From a run prompt, type: Runas /user:domainAdmin@yourDomain cmd {ENTER}
  2. Enter the password for that account when prompted.
  3. Enter WMIC by typing the following: wmic {ENTER} (you could do this directly from the run dialog, but for this example we’ll do it this way)

Step 2: Search and Destroy

  1. Use WMIC to list all installed WMI compliant software. Type: /node:COMPUTERNAME product get name,version,vendor {ENTER} (this will list installed software along with the vendor name and version).
  2. If you have special characters like “-” or “/” in the computer name you need to use ‘ characters in order to get information from that client. So if the client computer name is test-machine, you’ll need to enter it as: ‘test-machine’
  3. Call for uninstallation using WMI. If we wanted to remove Nero 7 Essentials, the command would look something like: /node:COMPUTERNAME product where name=”Nero 7 Essentials” call uninstall {ENTER}

At this point WMIC will prompt you to confirm the removal with something that will look like this: Execute (\\COMPUTERNAME\ROOT\CIMV2:Win32_Product.IdentifyingNumber=”{6CA9502E-177F-43A0-A37B-6EF47081A658}”,Name=”Nero 7 Essentials”,Version=”7.03.0279″)->Uninstall() (Y/N/?)?

If you reply “y”, WMI compliant software will run the default uninstallation procedures without the user needing to do anything (nor will they be notified).

Not all software can be removed using this method, however I find that enough can that it is a very useful trick to know.

WMIC is a very powerful tool, if you’d like to learn more about it, start here.



Advertisements

One Response to Command Line Kung Fu: Remotely uninstall software from the command line

  1. hanif says:

    I am trying to uninstall an application on remote machine but the name is not listed after entering product get name. Application is installed on the remote machine and I can even see it on Add/Remove program in control panel, but can not see it in WMIC, even I entered the name of the application based on the name which I found on control panel, but it says : No Instance(s) availalbe , any workaround ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: