(GroupWise) uninstall script

(GroupWise) uninstall script

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
)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Comments
Not everybody lives in US, so with Windows 7 bug it needs to be:

/format:"%WINDIR%\System32\wbem\en-us\csv"

as per: http://stackoverflow.com/questions/9673057/wmic-error-invalid-xsl-format-in-windows7
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-06-06 17:20
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.