Home > Blockchain >  Executing Uninstall String with parameters in Powershell
Executing Uninstall String with parameters in Powershell

Time:10-20

I get the following uninstall string from the registry:

$uninstallstring = MsiExec.exe /X{123-12323-123213-A6123-123123}"

I can execute this string with:

cmd /c $uninstallstring

That works but I want to execute it with the parameters /quiet and /norestart. But if I try to append the parameters, I cannot execute the uninstall string:

$uninstallstring =" /quiet /norestart"
cmd /c $uninstallstring

How to execute the uninstall string with these parameters in Powershell?

Thanks!

CodePudding user response:

In powershell 5.1, this should work with whatever the name is of the msi install.

uninstall-package 'google chrome'

CodePudding user response:

Try this from an elevated powershell prompt

$uninstallstring =  "/X {123-12323-123213-A6123-123123}"

$vars = " /quiet /norestart"

msiexec.exe $uninstallstring $vars | cmd
  • Related