I have a script designed as follows:

  • Verify - process "myprog.exe" is running
  • On success launch $(KACE_SYS_DIR)\msiexec.exe with params /X{prog GUID} /qn /norestart.
  • (on success continued) launch Launch $(KACE_APP_DIR)\runkbot.exe with params 4 0

This works great, but I found that I have in many cases two or three slightly different versions of the program where the GUID for each is different.  I find that I cannot add multiple msiexec uninstall commands because when the first one returns the error "This can only be run for installed....." then the second msiexec uninstall command does not run.

I would like the option to be able to uninstall several versions in one script.

0 Comments   [ + ] Show Comments


Please log in to comment

Community Chosen Answer


An example of using it in vbs:

set Installer=CreateObject("WindowsInstaller.Installer")
Set shell = CreateObject("WScript.Shell")
if Installer.ProductState(productcode) = 5 then
 strRun="msiexec /x " & productcode & " /qn"  
 error_code = shell.Run(strRun,1,True) 
end if 

Note: Create an array of product codes to be uninstalled and parse the array passing the "productcode" to above code.

Answered 09/16/2013 by: Sujit J
Blue Belt

Please log in to comment




You can either have some error control logic added in the script so that you can log the error in a txt or log file and contuine with the other uninstallation in case of any failures



Answered 09/14/2013 by: sumitsingh1984
Second Degree Green Belt

  • Your script should be altered to test for the product's installed state. Check MSDN for details of the 'WindowsInstaller.Installer object model. From memory, the property is 'ProductState'.
  • OK, so the only way I can do it is to create a VBScript script rather than using the built in KACE wizard.
Please log in to comment
Answer this question or Comment on this question for clarity