Page 1 of 1

Script Uninstall via MSIEXEC by ProductCode

Posted: 04 Dec 2018 08:47
by leostor
0
down vote
favorite
need to create a script for uninstall a specific windows program via MSIEXEC with a specific Product code;

I can get the product code in this way:

wmic product where name="Program xxx" get IdentifyingNumber

and result is:

IdentifyingNumber {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX}

once I have found the identify number, I will uninstall it this way:

MSIEXEC /x {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX} /qb REBOOT="ReallySuppress" PASSWORD=password123

how can I create a script to automate the process by putting the parameter from the wmi query in the msiexec uninstall command?

THANKS A LOT

Re: Script Uninstall via MSIEXEC by ProductCode

Posted: 04 Dec 2018 12:44
by aGerman
Try that:

Code: Select all

@echo off &setlocal
for /f "delims=" %%i in ('2^>nul wmic product where "name='ASUS GiftBox Serviceq'" get IdentifyingNumber /value') do for /f "tokens=2 delims==" %%j in ("%%i") do (
  MSIEXEC /x %%j /qb REBOOT="ReallySuppress" PASSWORD=password123
)
Unlike your crossposting which is tagged as Javascript …
https://stackoverflow.com/questions/536 ... roductcode
… the code above is Windows Batch.

Steffen

Re: Script Uninstall via MSIEXEC by ProductCode

Posted: 07 Dec 2018 04:02
by Earara
aGerman wrote:
04 Dec 2018 12:44
Try that:

Code: Select all

@echo off &setlocal
for /f "delims=" %%i in ('2^>nul wmic product where "name='ASUS GiftBox Serviceq'" get IdentifyingNumber /value') do for /f "tokens=2 delims==" %%j in ("%%i") do (
  MSIEXEC /x %%j /qb REBOOT="ReallySuppress" PASSWORD=password123
)
Unlike your crossposting which is tagged as Javascript …
https://stackoverflow.com/questions/536 ... roductcode
… the code above is Windows Batch.

Steffen
Thanks for this help! I had the same issue!