Showing posts with label msiexec. Show all posts
Showing posts with label msiexec. Show all posts

Monday, 11 August 2014

Uninstall MSI from command line


From a command prompt, run with elevated permissions:
msiexec /x {ba5eba11-deaf-beef-ce11-ca5e1337c0de} /qn
where {ba5eba11-deaf-beef-ce11-ca5e1337c0de} is the product code of the application you want to uninstall.

From PowerShell, run with elevated permissions:
msiexec /x "{ba5eba11-deaf-beef-ce11-ca5e1337c0de}" /qn
If you don't know the product code you can get it from the registry, using wmic or from PowerShell using the following command:
gwmi -Class win32_product | ?{$_.Name -match "product name"}
For 7-zip the product code is:

PS C:\Users\Bob> gwmi -Class win32_product | ?{$_.Name -match "7-zip"}

IdentifyingNumber : {23170F69-40C1-2702-0920-000001000000}
Name              : 7-Zip 9.20 (x64 edition)
Vendor            : Igor Pavlov
Version           : 9.20.00.0
Caption           : 7-Zip 9.20 (x64 edition)

Thursday, 6 September 2012

Use Msiexec to install or uninstall particular features of a Wix Installer

A few days ago the requirements changed again, isn't Agile development a hoot?, and all of sudden I found myself needing to modify the PowerShell script  that we've been using to install the build, I'll probably publish it in another post. It turns out that not all the servers servers needed all features installed which prompted a furious bout of Googling.

It's quite simple:
msiexec /i build.msi ADDLOCAL=MyFeature
If you want to install several features, just separate them with commas:
msiexec /i build.msi ADDLOCAL=Website,Webservices
Note that if the features need public properties to be set, then remember to do so, as otherwise it will fail to install, something like this:
msiexec /i build.msi ADDLOCAL=Website SQLSERVERINSTANCE=myinstance 

Since I did not want to uninstall and reinstall the relevant features I did another bout of less furious Googling to find out how to remove a particular feature only.

This is somewhat counter-intuitive as you use the install flag:
msiexec /i build.msi REMOVE=Website