How to Uninstall Software on Remote Computers Using a Command Line

WMIC (Windows Management InstrumentationSurround the like phrase in double quotes and your
Command-Line) is a potent tool that often doesn'tsearch criteria in single quotes, and use % as the
see much use due to the lack of (easily accessible)wildcard symbol.e.g.: /node:ComputerXYZ product
documentation available. For this technical article forwhere "vendor like 'adobe%'" get
IT professionals, we'll be using WMIC with domainname,version,identifyingNumber )
admin credentials to crawl through a list of nodes4. Call for the Uninstallation
(PCs/Laptops) and uninstall an example programSo we can make a call to the WMI interface to
without interrupting the user.uninstall a particular product... let's pick on the
1. Load up a command shell with appropriate accessMobileMe Control Panel from our previous example.
permissionsThe command:
Though a WMIC instruction can be given appropriate>/node:EXAMPLE product where name="MobileMe
credentials prior to operation, it is typicallyControl Panel" call uninstall
best-practice to avoid clear-text typing the password... will prompt you for confirmation in the following
(who is that looking over your shoulder;)). We'll(long) format:
execute the runas command like the following:Execute
Runas /user:DomainAdminAccount@DOMAIN cmdme="MobileMe Control
... which will prompt us for the credentials of ourPanel",Version="2.1.0.24")->Uninstall() (Y/N/?)?
DomainAdminAccount. If authenticated, we'll be.. to which you must reply 'y' if you wish to uninstall.
handed a command shell running as the Admin.WMI compliant software will run the default
2. Step into WMICuninstallation procedures without the user needing to
One of the nice features of WMIC is that it may bedo anything (they receive no prompts etc).
run from any machine. With our admin command shell,5. Call Uninstall for a List of Machines (an optional
we're going to enter the WMIC command followedinformative step)
by enter. (Note: We could have jumped into WMICLet's assume you just got word that Adobe Reader
directly from the runas command... this just breakshas a serious flaw in it's old version. In a panic, you
out the steps)asked all your users to blindly install the new version
3. Verify Program Installation (an optional informativeof Adobe reader straight from Adobe's site.
step)Thankfully, they all managed to do so... however
With our WMIC prompt, we can ask many questionsyou've received 3 tickets so far about an icon on the
of a node (or nodes) and receive some nicelydesktop.
formatted replies. Though formatting the replies isYou have a flat text file of all your computer's
beyond the scope of this "How To", much morenames stored in c:computers.txt. You pop open a
information can be found on the Internet.WMIC shell with appropriate permissions and enter
So let's find out if a particular node even has ourthe following command:
target software:>/node:@"c:computers.txt" product where
>/node:COMPUTERNAME product getname="Acrobat.com" call uninstall
name,version,vendorWhich iterates through your list, skipping nodes that
This command asks WMI to reply with a list includingare invalid (eg:machine is turned off) and those that
the Name, Version, and Vendor of all compliantdon't meet the criteria. You'll need to confirm 'y' that
software installations.you want to uninstall on every node... but that may
If you would like to filter for a specific product, yoube a small price to pay for not needing to run around
may do so. Here's an example scanning a networkedto every machine.
machine for all installed applications from the vendorConclusion
"Apple, Inc"Hopefully you've been intrigued by the potency of
>/node:ANOTHEREXAMPLE product whereWMIC. Though the command-line use of the uninstall
vendor="Apple Inc." get name,vendorcall may not be commonly needed with software
A small hint if you have special characters like '-' or '/'management tools, AD, etc... it can sometimes be the
in the computer name you need to use ' ' charactersbest way to accomplish a task quickly without
in order to get information from client)disturbing your user(s).
Here is how you use wildcards in your search:Learn more about WMIC at their official web site.