license:
AS-IS A powerful Windows CMD script that query's WMI for MSI package names containing the string stored in variable '__FILTER'.
Then, it performs a silent uninstall of any packages that it finds a match.
I developed it to remove Groupwise Clients (those that utilize MSI) which were installed with all different configurations throughout the enterprise. Most everyone was on GW802.
I am submitting this as a GW removal tool, but really, you could use this code to query any string to uninstall any product.
Call it as a function from a for loop to perform different query's etc . . .
Hope someone can find a good home for it.
@echo off REM Written by Ed Radke DTS/Corrections REM Script query's WMI for MSI packages names containing the string stored in variable '__FILTER'. REM Then, it performs a silent uninstall of any packages that it finds a match. REM A string that will be searched for in the product name to be uninstalled. REM BE CAUTIOUS WHAT YOU TYPE HERE. REM too broad of a query could render your system useless. REM If you're not sure try this wmic command alone to see what it returns::: REM wmic product where (name like "%PUT_YOUR_STRING_HERE%") get name,packagecache /format:csv set __FILTER=groupwise REM Output of wmic set __OUT=%TEMP%\WMIC_GW.TXT REM Uninstall Log file SET __LOG=C:\gw_remove.txt REM Remove output if it exists if exist "%__OUT%" del /f /q "%__OUT%">NUL 2>&1 echo Initializing REM search for MSI product's local package wmic /output:"%__OUT%" product where (name like "%%%__FILTER%%%") get name,packagecache /format:csv REM Output is unicode, convert to ANSI type "%__OUT%">"%__OUT%.tmp" type "%__OUT%.tmp">"%__OUT%" REM Perform uninstall, reboot is suppressed for /f "usebackq tokens=2,3 skip=2 delims=," %%A in ("%__OUT%") do ( echo Un-installing "%%A" msiexec.exe /x "%%B" /qn /l*v "%__LOG%" REBOOT=REALLYSUPPRESS )