WMIC and Windows Installer products

Windows Installer (.MSI) installs are great for remote administration.  One of the under-utilized tools (IMHO) is WMIC, the WMI interface from a command prompt.  I got these tips from Darwin Sanoy, when I took his excellent class on Windows Installer. (http://www.windowsinstallertraining.com)

Examples of some commands:

To get a list of all MSI products installed on the remote computer:
WMIC /node:"computername" product list > c:\1.txt
WMIC /Node:"computername" /output:c:\1.csv product get /format:csv

To uninstall (similar to msiexec /x {guid} /qn):
WMIC /node:"computername" product where name="Widgets" call uninstall

To uninstall using alternate credentials:
WMIC /node:"computer" /user:"userid" /password:"yourpassword" product where name="Widgets" call uninstall

Why would you use this?  I only occasionally have needed this; but once in a while during a company-wide rollout & a few machines upgraded badly, the easiest solution is to uninstall and reinstall the app.  Since you can't easily use SMS to trigger an uninstall for 1-off computers quickly without remote controlling the box or sending a tech, I've used this to uninstall an app, and then used any one of multiple available tools to re-run the mandatory SMS advertisement.

If you don't know the name of the product, use the list command to dump it; and then you can use one of the uninstalls.  I know this information is usually available in the Add/Remove Programs information reported to SMS--but when you are in troubleshooting mode, this is a way to get accurate information about what is installed.

Notes: Because there are occasionally .MSIs that were crafted in ways where the product information is not populated into the WMI class win32_product, if you are expecting to see a product and it is not listed, that particular application may have been crafted in that way.  In those (rare) cases, a remote session, local tech, or some other solution will be required.

Published Wednesday, October 04, 2006 11:02 AM by skissinger
Filed under: ,


No Comments