Archive

Archive for the ‘msiexec’ Category

Silent installation and removal of MSI packages

November 1st, 2016 No comments

 

Installing MSI files silently

 

To perform the really silent installation of an MSI file, you can use a command line which looks like this:

msiexec.exe /i ApplicationName.msi /qn /norestart

 
Some MSI files provide more options, usually to let you customize the application (apply settings, install only some parts,…).
 

Removing MSI files silently

 

To perform the silent removal (uninstallation) of an MSI file, use a command line which looks like this:

msiexec.exe /x {ProductCode} /qn

 
There is also a more generic command to remove applications that were installed by MSI files:

wmic product where "caption like '%Google Chrome%'" call uninstall /nointeractive

 
In this example, Google Chrome would be uninstalled silently (or more specifically, apps with “Google Chrome” in their name).

 

How to find the MSI product code

 

A simple one-liner in Powershell will do:

get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name

 

This will produce output looking much like this:

{26A24AE4-039D-4CA4-87B4-2F32180102F0} Java 8 Update 102
{E1201675-B966-4B97-82D9-01F292173B49} Client Center for Configuration Manager
{AC76BA86-7AD7-1033-7B44-AC0F074E4100} Adobe Acrobat Reader DC
{343D4507-997F-4553-9F86-2BB81F19A05E} Configuration Manager Client
{BBAF8C17-51A4-3A52-A9C7-08229B38346E} Google Chrome
{90D295B8-BA08-487E-B904-0E624209A410} Microsoft Policy Platform
{B175520C-86A2-35A7-8619-86DC379688B9} Microsoft Visual C++ 2012 x86 Additional Runtime 
{1F1C2DFC-2D24-3E06-BCB8-725134ADF989} Microsoft Visual C++ 2008 Redistributable - x86
{165CC34D-37E9-4B88-A5AA-D0FA2EB5A8CE} DameWare Mini Remote Control 7.5
{EC542D5D-B608-4145-A8F7-749C02BE6D94} Dell Command | Update

 
The productcodes can then be found in the left colum of the output. Note that the above line of code will return the productcodes of all the MSI-based software, installed on your system. This might take quite some time.

 

If you want to lookup the productcode of a specific software, the next code example might be more useful:

get-wmiobject Win32_Product | where Name -Like "*Acrobat Reader*" | Format-Table IdentifyingNumber, Name 

 

In this case, the output returns the productcode for just 1 product:

IdentifyingNumber                      Name                   
-----------------                      ----                   
{AC76BA86-7AD7-1033-7B44-AC0F074E4100} Adobe Acrobat Reader DC

 
Enjoy 🙂

 

Categories: configmgr, MSI, msiexec, powershell, sccm, wmic Views: 832