How to kill cmd.exe while uninstalling msi with psexec

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.

0 Comments   [ + ] Show comments

Answers (1)

Answer Summary:
Posted by: rad33k 5 years ago
Fourth Degree Brown Belt

Top Answer

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.

  • 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. - ninjalau2018 5 years ago
    • What is the result of calling msiexec /x with /QN instead of /QB ? - rad33k 5 years ago
      • The result is what I wanted. Thank you very much!! - ninjalau2018 5 years ago
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