Scripting Question

How to kill cmd.exe while uninstalling msi with psexec

10/11/2018 1077 views
Hello guys,

I'm desperate finding a solution to the following issue:

While I'm trying to uninstall a vendor msi, by using psexec and the command msiexec /x Product code /qb! which has a .mst file applied on top of it, the software detects that cmd.exe is running and if I don't click on abort, ignore or kill the process, the uninstallation stops. I've tried to use a custom action inside install shield with the command: cmd.exe /c taskkill /IM cmd.exe with the condition REMOVE~="ALL" and to be run after publish product on deffered execution in system context, but it didn't work. The error 1722 appears.

Please help me. the delivery day for this solution is tomorrow.
Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author

I think that more details are required to help you.
Is it a message from a custom action or restart manager? If it is the restart manager dialog you can try the MSIEXEC /X with MSIRESTARTMANAGERCONTROL=Disable property added into the command line.

Does the MSI uninstallation complete successfully when you close the CMD window? If yes, you can try to call a VBS script, but I would strongly recommend to find the reason why it is failing and then think about a better solution.
Dim objShell        : Set objShell = CreateObject ("Wscript.Shell")
Dim objFSO            : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim strCurrentDir    : strCurrentDir = objFSO.GetParentFolderName(WScript.ScriptFullName)

objShell.Run "TASKKILL /F /IM cmd.exe /T",0,true
strCurrentDir &"\psexec.exe -si msiexec /x <<Product code>> /qb! /L*v...",1,true
If this does not solve the issue please upload the MSI uninstallation log file to eg. pastebin.
Answered 10/11/2018 by: rad33k
Fourth Degree Brown Belt

  • Hi. Thank for your input. In the MSI, I already have the property MSIRESTARTMANAGERCONTROL on Disable. However, I will try the script. And yes, the MSI uninstallation complete successfully after I close the CMD Windows, or not really needed to be closed, just ignored.
    • What is the result of calling msiexec /x with /QN instead of /QB ?
      • The result is what I wanted. Thank you very much!!

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ