0

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!

user18209625
  • 139
  • 2
  • 15
  • Hello, could you share the output of $uninstallstring after adding the additional flags. I'd like to see how it spits it out before I give my advice. Thanks - – Technoob1984 Oct 19 '22 at 12:00
  • MsiExec.exe /X{123-12323-123213-A6123-123123} /quiet /norestart – user18209625 Oct 19 '22 at 12:08
  • But I have another problem: If I execute MsiExec.exe /X{123-12323-123213-A6123-123123} with cmd, it says the the product is successfully uninstalled. But actually the product still exists. In the braces this is the upgrade code. Why doesn't it work? – user18209625 Oct 19 '22 at 12:09
  • Your code is missing an opening `"`. If that is just a posting artifact, then there's no obvious problem with your attempt. If the `Uninstall-Package` approach doesn't work for you and you still have a problem (as indicated in your previous comment), I suggest asking a _new_ question. – mklement0 Oct 19 '22 at 15:32

1 Answers1

0

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

uninstall-package 'google chrome'
js2010
  • 23,033
  • 6
  • 64
  • 66