Msiexec Uninstall Silent Example

We can automate the silent uninstallation of Office patches via a command line like so:

Uninstall

%windir%System32msiexec.exe /package {Office GUID} /uninstall {Patch GUID} /QN

Issue: You want to know how to uninstall Autodesk Products silently using Batch Scripts. You want to know, if there is a way to uninstall Autodesk Products remotely.

First we will need to determine what the GUID is for Office, and next what the GUID is for the patch that we are trying to uninstall.
To determine what the GUID is for the installed version of Office, look in the uninstall hive in the registry.

x86 OS
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{GUID}
x64 OS
HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall{GUID}

On my two example machines I have Office 2003, and Office 2007 installed.

The GUID for Office 2003 will be similar or equal to {90110409-6000-11D3-8CFE-0150048383C9}
The GUID may be slightly different then what I have listed here. Verify you found the correct GUID by verifying the product under the “Displayname” key listed in the GUID.

See also - Description of numbering scheme for product code GUIDs in Office 2003
Here is a screenshot of this registry key on my machine that has Office 2003.

The GUID for Office 2007 will be similar or equal to {90120000-0011-0000-0000-0000000FF1CE}
The GUID may be slightly different then what I have listed here. Verify you found the correct GUID by verifying the product under the “Displayname” key listed in the GUID.

See also - Description of the numbering scheme for product code GUIDs in 2007 Office suites and programs
Here is a screenshot of this registry key on my machine that has Office 2007.

Notice that there are many GUIDS that end in 0FF1CE in my screenshot above. The reason for this is because Office 2007/2010 is a multi-msi based product, and because of that there is a GUID for each component in Office 2007/2010. So for example if I clicked on {90120000-0015-0000-0000-0000000FF1CE} in my example above the “Displayname” would show “Microsoft Office Access MUI (English) 2007”. This is not the GUID for the Office suite. This is only the GUID for the Access MUI component. For Office 2007/2010 make sure that you find the GUID that has a display name that correlates with the name of the suite. ie.. Microsoft Office Professional Plus 2007, or Microsoft Office Standard 2007 etc..

Next we need to discover the GUID of the patch we are trying to uninstall. To do this we will want to look at the properties of the MSP file that is contained within the patch .exe.

First we will need to extract the MSP(s) from the patch executable.

The method to extract the contents from Office patches has changed since Office 2003.

To extract the contents from 2003 patches-
I will download the Office 2003 patch from KB2464588 as an example. (office2003-KB2464588-FullFile-ENU.exe)
For Office 2003 patches we will need to extract the MSPs from the executable using an extraction command like so to extract the MSPs from this patch executable to the c:temp directory:
office2003-KB2464588-FullFile-ENU.exe /c /t:c:temp

To extract the contents from 2007 patches-
I will download the Office 2007 patch from KB2464594 as an example. (PowerPoint2007-KB2464594-fullfile-x86-glb.exe)
For Office 2007 patches we will need to extract the MSPs from the executable using an extraction command like so to extract the MSPs from this patch executable to the c:temp directory:
PowerPoint2007-KB2464594-fullfile-x86-glb.exe /extract:c:temp

Now that we have the MSP from the patch executable we need to find the GUID of the patch.

We can find this by right clicking on the msp and going to properties. We will be looking for the revision number.
Sometimes there will be a lot of numbers in the revision number section. Copy/paste the list of revision numbers into notepad, and delete all but the first one. The first number in the list of revision numbers is the GUID.

*note* - In Vista you will not be able to find the GUID this way.

So using the POWERPNT.MSP file from KB2464588 as an example we discover that the GUID for this patch is {AB0D3DA9-FC93-4F57-ADE2-B6669749B25E} because that is the first number in the revision number properties.

From Windows XP:

From Windows 7:

So now we know that the Office 2003 suite GUID in my example is {90110409-6000-11D3-8CFE-0150048383C9}, and we know that the GUID for the Office 2003 patch from KB2464588 is {AB0D3DA9-FC93-4F57-ADE2-B6669749B25E}. So the command that could be used to programmatically remove this patch would be:

%windir%System32msiexec.exe /package {90110409-6000-11D3-8CFE-0150048383C9} /uninstall {AB0D3DA9-FC93-4F57-ADE2-B6669749B25E} /qn

*note*
You could use /qb for an automated uninstall with a progress bar, or use /qn for a totally silent uninstall.

We found that the GUID for Office 2007 in my example above was {90120000-0011-0000-0000-0000000FF1CE}, and the GUID for the Office 2007 patch KB2464594 is {E6B7C11E-21E9-4BA0-9677-29AD603B953C}.

Msiexec

So the command that could be used to programmatically remove this Office 2007 patch would be:

%windir%System32msiexec.exe /package {90120000-0011-0000-0000-0000000FF1CE} /uninstall {E6B7C11E-21E9-4BA0-9677-29AD603B953C} /qn

*note*
You could use /qb for an automated uninstall with a progress bar, or use /qn for a totally silent uninstall.

FAQ-

How can we determine if the patch is installed programmatically if we know the GUID of the patch?
A- This can be done once we convert the patch GUID to a compressed GUID. (How to convert an Office GUID, or Office patch GUID to a compressed GUID)
Then query for the compressed GUID at this registry location:

HKEY_CLASSES_ROOTInstallerPatches

So for example the patch GUID for KB2464588 is {AB0D3DA9-FC93-4F57-ADE2-B6669749B25E}. Once converted we find that the compressed GUID is 9AD3D0BA39CF75F4DA2E6B6679942BE5.

So if KB2464588 is installed the following registry key would exist:

HKEY_CLASSES_ROOTInstallerPatches9AD3D0BA39CF75F4DA2E6B6679942BE5

Is it possible to uninstall a patch that is not natively uninstallable?
A- While it is not recommended, nor supported by Microsoft it is possible to uninstall patches that are marked as not uninstallable. Once again we will need to convert the patch GUID to a compressed GUID. (How to convert an Office GUID, or Office patch GUID to a compressed GUID)
Using the same example above we know that KB2464588 has a compressed GUID of 9AD3D0BA39CF75F4DA2E6B6679942BE5. The registry key that determines whether or not this patch is uninstallable will be located here:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18Products[Office guid]Patches9AD3D0BA39CF75F4DA2E6B6679942BE5

'Uninstallable'=dword:00000001

If the patch is not uninstallable natively, it would be possible to change the 'Uninstallable' value at this registry location to “1” and then the patch would be available to uninstall.

We have a patch that has multiple MSP files inside of it. Is this normal? Would we need to uninstall them all?
A- It is not uncommon for Office patches to contain multiple MSP files. If you wanted to completely remove the patch you would need to uninstall each of the MSPs.

It is also not uncommon for Office patches to apply to multiple products and as such show up multiple times in Add/Remove. In these cases to completely remove the patch you would need to run the uninstall command targeting the GUID for each Office product that has the patch installed.

Active5 years, 2 months ago

I need to uninstall a MSI package through command line.So i used:

msiexec /x package.msi

But this command requires the package.msi to be present in the local machine.

I want to uninstall the msi even if the msi file is missing.

How can I do that?

kinokijuf
6,8858 gold badges45 silver badges89 bronze badges
SandeepSandeep
2502 gold badges5 silver badges14 bronze badges

migrated from stackoverflow.comJun 6 '11 at 13:23

This question came from our site for professional and enthusiast programmers.

2 Answers

You can uninstall it using the product code:

You would obtain this code from the MSI itself, or whatever tool you are using to build the MSI.

Note that when you uninstall a product, it uses a cached MSI, since only the original MSI knows how to uninstall itself. When you use the product code, it uses the cached MSI from C:WINDOWSInstaller.

vcsjonesvcsjones
2,3481 gold badge13 silver badges20 bronze badges

See my answer on stackoverflow.com for various ways to uninstall MSI files / Windows Installer Packages from your computer.

You can uninstall via: msiexec, ARP, WMI, PowerShell, Deployment Systems such as SCCM, VBScript / COM Automation, DTF, or via hidden Windows cache folders, and a few other options.

Msiexec Silent Switch

Community

Msiexec Uninstall Command

Stein ÅsmulStein Åsmul
8891 gold badge12 silver badges22 bronze badges

Msiexec Uninstall No Prompt

Not the answer you're looking for? Browse other questions tagged command-lineinstallationwindows-installer or ask your own question.