Automate Office Patch uninstallation programmatically


To totally unlock this section you need to Log-in


Login

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

%windir%\System32\msiexec.exe /package {Office GUID} /uninstall {Patch GUID} /QN

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_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID} 
x64 OS 
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{GUID}

For this example we will take focus on an old Office 2003 and Office 2007 installations.

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

Here is a screenshot of this registry key on my machine that has Office 2003.

Automate Office Patch uninstallation programmatically

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.

Here is a screenshot of this registry key on my machine that has Office 2007.

Automate Office Patch uninstallation programmatically

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 we 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 Office 2003 patches:

  • We 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 Office 2007 patches:

  • We 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 Windows 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 property.

From Windows XP:

Automate Office Patch uninstallation programmatically

From Windows 7:Automate Office Patch uninstallation programmatically

So now we know that the Office 2003 suite GUID in our 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%\System32\msiexec.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 our example above was {90120000-0011-0000-0000-0000000FF1CE}, and the GUID for the Office 2007 patch KB2464594 is {E6B7C11E-21E9-4BA0-9677-29AD603B953C}.

Automate Office Patch uninstallation programmatically

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

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

We have a patch that has multiple MSP files inside of it. Is this normal? Would we need to uninstall them all?

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.