0

I know the install location of a program installed via a MSI. I want to write a script that will remove it. I do not know the GUID as it changes often. How do I accomplish this goal?

I checked out the command line options for the installer tool, but I didn't see anything that would allow me to specify the install location to select a product.

bruestle2
  • 727
  • 1
  • 8
  • 22
  • 2
    Assuming you can write some code for this, you could try the techniques I covered [over here](http://stackoverflow.com/a/37591273/89999). – Michael Urman Jun 29 '16 at 12:09

2 Answers2

3

You will need to find the UpgradeCode (look in the installation log file for the property).

From there, use MsiEnumRelatedProducts to iterate over all the instances of the product. The vast majority of products don't support multi-instance installations, so there should only be one product code returned in the buffer.

Once you know the ProductCode, you can msiexec /x {PRODUCT-GUID} to your heart's content.

If you're not comfortable with C++, you can find different implementations of MsiEnumRelatedProducts in PowerShell extensions and C# libraries, to name a few.

Damon D
  • 186
  • 6
2

You can find the Product code like this: How can I find the product GUID of an installed MSI setup? and invoke the uninstall using: msiexec.exe /x {product-guid-here}

There are many ways to uninstall an MSI file, here are 13 different ways: Uninstalling an MSI file from the command line without using msiexec. Check out section 5 for a way to uninstall by product name using PowerShell.

Here is a VBScript that uninstalls by reading the product details from the registry (resurrected from WayBack): https://web.archive.org/web/20160318175702/http://www.symantec.com:80/connect/downloads/uninstall-application-using-guid-registry

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164