Silent MSI removes a GUID that does not exist

I am trying to silently delete my application. This works fine if the application is really installed, but when the user does not receive an error message and must click "OK" to continue.

My team:

  MSIEXEC.EXE / qb / L * "% LOGDIR% \ myuninstaller.log" / x {GUID} 

The problem is that I need to clear all old versions of the application in a script that I am deploying in AD. I do not know which version is installed on which computer, and make the script determine what is so difficult.

How can I make MSIEXEC NOT complain about removing a GUID that does not exist?

+7
source share
4 answers

If all your applications have corresponding GUID keys in "KEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall", you can also do something like this:

reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID} >NUL 2>NUL || MSIEXEC.EXE /qb /L* "%LOGDIR%\myuninstaller.log" /x{GUID} 

This will only start msiexec.exe if the key is present (and will be slightly more efficient than running msiexec.exe on non-existent GUIDs using / qn).

+2
source

Found the answer at http://technet.microsoft.com/en-us/library/cc759262(WS.10).aspx#BKMK_SetUI

It seems I need to use /qn instead of /qb .

+3
source

In my case, it works with: (pay attention to the & & operator)

 reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID} >NUL 2>NUL && MSIEXEC.EXE /qf /L* "%LOGDIR%\myuninstaller.log" /x{GUID} 

according to this link http://www.robvanderwoude.com/condexec.php , the subsequent command (msiexec.exe) will be executed only if the first command was successful (the result was error free). You can try to test each command separately.

 reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID} >C:\registrycheck.log 
0
source

Although you have an accepted answer, please check this message on serverfault.com: Can I disable the GUI for the msiexec command line? . There are many ways to remove MSI through automation, so you don’t have to deal with msiexec.exe at all.

Perhaps this is useful Removing the MSI file from the command line without using msiexec .

0
source

All Articles