Sometimes you cannot uninstall the existing 2003, 2007 or 2010 Microsoft Office suite on your computer by using the Add or Remove Programs feature in Control Panel of Windows XP or the Programs and Features feature in Control Panel of Windows Vista/Win7. To help with this Microsoft has created Fix it utilities at http://support.microsoft.com/kb/971179.

Office uninstallation can fail if any of these are true:

  • The installation process did not complete when you tried to install a new program. Therefore, you are left with a partially installed program. When you try to install the program again, you are unsuccessful.
  • A previously installed program cannot be removed because the installation files are corrupted.
  • If you had problems installing Office 2010 from a previous attempt.
  • Office cached patches, or cached source is corrupt.

These fix it utilities can remove Office 2003-2010 products regardless of the current health of Office. These fix it utilities are provided as MSI files and run automatically without user invention. This is a good solution for folks that have a single machine that cannot uninstall the Office Suite under normal conditions. There are some limitations to the fix it solutions however. Because it is automatic, the end user cannot specify which products to remove, and the MSIs will only remove Office Suites. It will not help with the removal of standalone products. Also, the fix its lack the ability to be automated. So if you needed to run these on multiple machines, you would need to do so manually.

Fortunately, the VBS engine that the fix it uses can be obtained from the fix it and can then be automated.

Instructions to obtain Offscrub.vbs from the fix it utilities:

1. Download the fix it for the appropriate version of office, and run it.
2. Agree to the EULA and click next.
3. When you get to this screen stop and browse to the %temp% directory.

fixit2

4. Find the Fixit directory in the %temp% directory and copy it to the desktop

fixit3

5. You can now cancel the Fixit utility. Browse to the Fixit folder you copied to the desktop, and inside you will find offscrub.vbs. (OffScrub07.vbs in my example since I ran the Fixit for Office 2007)

Offscrub07

Now that we have obtained the Offscrub07.vbs script from the Office 2007 Fixit, we can run it manually outside of the Fixit. We can also automate it’s usage from a command line with a variety of variables.

If you run the Offscrub2007.vbs script manually, by double-clicking or by calling it with cscript without any switches you will be presented a screen like the following:

Offscrub2

In my example screenshot we can see that Offscrub found Access 2007 Standalone, Office 2007 Standard, and Visio Standard 2007 are installed. If I click ok on this screen the way it is, Offscrub will remove all three products from the machine. If I only wanted to remove Visio, I would remove everything in this box except VISSTD and click ok.

Using this manual method you can use Offscrub to remove Office 2007 standalone products, which you would not be able to do if you were running the Fixit alone.

If you want to automate Offscrub you can do so via command line.

Usage:  OffScrub07.vbs [List of config ProductIDs] [Options]

        /?                               ' Displays the help
        /Force                           ' Enforces file removal. May cause data loss!
        /S           ' Does not search the local hard drives for shortcuts  (*NOTE* The help file lists /SkipShortcutDetection as a valid switch to skip shortcut detection but this is incorrect. Use /S instead.)

        /Log [LogfolderPath]             ' Custom folder for log files
        /NoCancel                        ' Setup.exe and Msiexec.exe have no Cancel button
        /OSE                             ' Forces removal of the Office Source Engine service
        /Q                         ' Setup.exe and Msiexec.exe run quiet with no UI
        /Preview                         ' Run this script to preview what would get removed

Examples:
        OffScrub07.vbs CLIENTALL         ' Remove all Office 2007 Client products
        OffScrub07.vbs SERVER               ' Remove all Office 2007 Server products
        OffScrub07.vbs ALL                     ' Remove all Office 2007 Server & Client products
        OffScrub07.vbs ProPlus,PrjPro   ' Remove ProPlus and Project
 
Stages of the script
===============
- Basics :    Non customizable tasks
- Stage 1:    Component detection. Builds a list of files which are installed/registered to a product that's going to be removed.
        Depending on the amount of applications that are removed - this can be a very time consuming task.
        "/Bypass 1" allows to bypass this detection.
- Stage 2:     Remove products with Setup.exe
- Stage 3:     Remove products with direct calls to Windows Installer
- Stage 4:     CleanUp - scrub files and registry settings that remained from the previous stages.
        In combination with 'Stage 1' this is the core of the removal concept.

Usage Examples
==============
- "Safe" (Similar to calling setup.exe)
    OffScrub07.vbs ALL /Bypass 1,3,4
    OffScrub07.vbs ALL /Bypass 1,3,4 /Quiet
    OffScrub07.vbs ProPlus /Bypass 1,3,4 /Quiet

- "Preview"
    OffScrub07.vbs ALL /Preview
    OffScrub07.vbs ALL /Bypass 2 /Preview

   Note: The preview option will not give the same results as the true removal. 
   Still useful to get a good picture of what will be removed on the client

- "Quiet"
    OffScrub07.vbs ALL /Quiet

   Note: The CMD output window will still receive all messages but the UI for Setup and Msiexec tasks will be suppressed.

- "NoCancel"
    OffScrub07.vbs ALL /NoCancel

   Note: Setup and Msiexec tasks have no "Cancel" option


So if we were going to script the automation of Office 2007 ProPlus so that the uninstallation was silent, and couldn’t be cancelled, we would run a command like so:

cscript offscrub2007.vbs ProPlus /Q /NoCancel /BYPASS 1

I would advise that when automating Offscrub you skip the component detection (Stage 1) . You do this by using “/Bypass 1”.
The reason is because I have seen instances where component detection causes third party products to attempt repair. Usually this is not big deal, but if the third party product is in an unhealthy state (for example it’s missing it’s cached MSI) than it will prompt the user to locate the MSI and thus stall Offscrub. Obviously not desired if we are looking to automate the removal with no user intervention.

 

FAQ-

How can we remove the black window that populates when Offscrub is run?
A- If the command prompt screen is closed while offscrub is running it will fail to continue. We can prevent that by hiding the command prompt window. Edit the the Offscrub.vbs file and find for the following code at the bottom of the script:

 

Sub RelaunchAsCScript
Dim Argument
Dim sCmdLine

sCmdLine = "cmd.exe /k " & WScript.Path & "\cscript.exe //NOLOGO " & Chr(34) & WScript.scriptFullName & Chr(34)
If Wscript.Arguments.Count > 0 Then
For Each Argument in Wscript.Arguments
sCmdLine = sCmdLine & " " & chr(34) & Argument & chr(34)
Next 'Argument
End If
oWShell.Run sCmdLine,1,False
Wscript.Quit
End Sub 'RelaunchAsCScript
Replace with the following code and resave:
Sub RelaunchAsCScript
Dim Argument
Dim sCmdLine

sCmdLine = "cmd.exe /k " & WScript.Path & "\cscript.exe //NOLOGO " & Chr(34) & WScript.scriptFullName & Chr(34)
If Wscript.Arguments.Count > 0 Then
For Each Argument in Wscript.Arguments
sCmdLine = sCmdLine & " " & chr(34) & Argument & chr(34)
Next 'Argument
End If
oWShell.Run sCmdLine,0,False
Wscript.Quit
End Sub 'RelaunchAsCScript


We have elected to use the Offscrub method and hide the CMD prompt window that Offscrub populates, but now find that there is no message to the user that the Office installation is taking place. Can we generate a notice to the users so they know that Office is being installed, and don’t try to shut down or disconnect the PC in the middle of the install?
A- It is not uncommon for folks to want to disable the command prompt window that Offscrub generates, because if that command prompt window is closed by the end user, then Offscrub will not complete.

You can launch a custom IE window or a CMD window to act as the user notification if you wish. As an example, you could add the following to launch a nice notice to the user:

start "----NOTICE----" cmd.exe /t:ec /Q /k "echo OFFICE 2010 IS BEING INSTALLED. THIS WINDOW WILL CLOSE WHEN COMPLETE&&prompt $h"

Then after the install completes, close the CMD notification with:

XP
taskkill /IM cmd.exe /FI "WINDOWTITLE EQ ----NOTICE----"
Win7
taskkill /IM cmd.exe /FI "WINDOWTITLE EQ Administrator: ----NOTICE----"


The shortcut detection seems to take a long time. Can it be avoided? 
A- Yes. The shortcut detection will try to scan all drives on a machine for the Office shortcuts that align with the product being removed. This can be skipped by use a “/s” option switch when running Offscrub.