Executing Uninstall String with parameters in Powershell

724 Views Asked by At

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!

1

There are 1 best solutions below

0
js2010 On

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

uninstall-package 'google chrome'