Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / MS Office / How to Automatically Uninstall All Previous Office Versions using OffScrub Script

June 28, 2018 MS OfficeSCCM

How to Automatically Uninstall All Previous Office Versions using OffScrub Script

To solve the problem of bulk MS Office update to the latest version on all user computers (Office 2016 should be deployed through SCCM and activated on Office 2016 KMS server), we needed to develop a simple script to automatically and correctly remove of any previously installed versions of Microsoft Office. This script should be used in tasks of automatic uninstall / installation of Office using SCCM packages.

Before installing a new Office version, it is recommended to remove any previously installed versions of MS Office (simultaneous use of different Office versions on a computer is supported, but not recommended due to potential problems). Therefore, there was a need to develop a script that would correctly uninstall any Office version previously installed on a PC.

Contents:
  • OffScrub VBS Scripts
  • Running OffScrub VBS Scripts Using SCCM
  • Office Removal Scripts
  • Automatically Detecting the Version of MS Office

OffScrub VBS Scripts

After considering several ways of uninstallation of previously installed Office versions, we stopped at using OffScrub scripts from the Microsoft Premier Support service. OffScrub scripts are included in the official EasyFix package. (The package of forced Office 2007 and 2010 uninstallation if it is not possible to uninstall them from the Control Panel.) To remove Office 2013 and 2016, another tool is used, O15CTRRemove.diagcab package, that also contains OffScrub scripts (see the note below).

OffScrub is a set of VBS scripts for automatic removal of Office products. These scripts allow you to completely clean the system from previously installed Office components, independent of its current operability. Here are the main advantages of using Offscrub to uninstall Office:

  1. The ability to uninstall the old Office version even if there are no or damaged original installation files or Office cache.
  2. User keys in the registry are not affected.
  3. Complete Office removal.
  4. Removal of all obsolete settings and all products (including Project, Visio, Visio Viewer).

Remove-PreviousOfficeInstalls.ps1 script from O15CTRRemove.diagcab package allows to detect the installed Office version and call Offscrub*.vbs for the corresponding Office version.

First of all, download FixIt from the official Microsoft website for those Office and Windows versions you are using in your infrastructure. You can download O15CTRRemove.diagcab package for different Office and Windows versions from this page (https://support.microsoft.com/en-us/kb/971179).

Important note! Earlier on this page there were links to both the EasyFix package and O15CTRRemove.diagcab. At the moment, there is only a link to the universal package O15CTRRemove.diagcab, which can be used to remove Office 2013/2016 on Window 7 SP1, Windows 8.1 and Windows 10. Also, early this year Offscrub scripts for new Office versions were in O15CTRRemove.diagcab, and now only PowerShell scripts are left in it. These (and other) Offscrub VBS scripts can now be obtained only from the official repository of Office developers on GitHub (OfficeDev).

In the following table I have collected the links to Microsoft packages to uninstall different Office versions in different OS versions.

Office Version Windows 7 Windows 8 Windows 10
Office 2003 MicrosoftFixit20054.mini.diagcab No
Office 2007 MicrosoftFixit20052.mini.diagcab No
Office 2010 MicrosoftFixit20055.mini.diagcab
Office 2013 File OffScrub_O15msi.vbs on GitHub
Office 2016 File OffScrub_O16msi.vbs on GitHub
Office 365/ Click-To-Run File OffScrubc2r.vbs on GitHub

Office removal scripts - Offscrub on GitHub

Download these files and save them to C:\tools\OfficeUninstall. *.diagcab files are the common archives in the CAB format, and you can unpack them using the expand command.

To make it easier, create a separate directory for each Office version:

set OFFICEREMOVE=C:\tools\OfficeUninstall\
md "%OFFICEREMOVE%\2003"
md "%OFFICEREMOVE%\2007"
md "%OFFICEREMOVE%\2010"
md "%OFFICEREMOVE%\2013"
md "%OFFICEREMOVE%\2016"
md "%OFFICEREMOVE%\O365"

Unpack only VBS files from the downloaded diagcab archives.

expand -i "%OFFICEREMOVE%\MicrosoftFixit20054.mini.diagcab" -f:OffScrub*.vbs "%OFFICEREMOVE%\2003"
expand -i "%OFFICEREMOVE%\MicrosoftFixit20052.mini.diagcab" -f:OffScrub*.vbs "%OFFICEREMOVE%\2007"
expand -i "%OFFICEREMOVE%\MicrosoftFixit20055.mini.diagcab" -f:OffScrub*.vbs "%OFFICEREMOVE%\2010"

And copy the VBS files for new Office versions downloaded from GitHub into the same directories.

move /y "%OFFICEREMOVE%\OffScrub_O15msi.vbs" "%OFFICEREMOVE%\2013"
move /y "%OFFICEREMOVE%\OffScrub_O16msi.vbs" "%OFFICEREMOVE%\2016"
move /y "%OFFICEREMOVE%\OffScrubc2r.vbs" "%OFFICEREMOVE%\O365"

expanding MicrosoftFixit.mini.diagcab

Thus, we have got the following VBS files:

  • 2003\OffScrub03.vbs
  • 2007\OffScrub07.vbs
  • 2010\OffScrub10.vbs
  • 2013\OffScrub_O15msi.vbs
  • 2016\OffScrub_O16msi.vbs
  • O365\OffScrubc2r.vbs

You can get the list of available arguments for any OffScrub VBS script as follows:

OffScrub_O16msi.vbs /?

Microsoft Customer Support Service – Office 2016 MSI Removal Utility
OffScrub_O16msi.vbs helps to remove Office 2016 MSI Server and Client products
Usage: OffScrub_O16msi.vbs [List of config ProductIDs] [Options]

OffScrub_O16msi.vbs

Running OffScrub VBS Scripts Using SCCM

In order the Office uninstallation script to work correctly on Windows x64 if run by the 32-bit Configuration Manager client, you should run the corresponding cscript.exe version. So to run the scenarios on a 64-bit system, you need to run cscript.exe from C:\Windows\SysWOW64.

You can achieve this using NativeCScript.cmd script:

@echo off
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" (
"%SystemRoot%\Sysnative\cscript.exe" %*
) else (
"%SystemRoot%\System32\cscript.exe" %*
)

You can download a ready-to-use archive with all necessary files from our website: OfficeRemova-OffScrubl.zip (1.4 MB)

Office Removal Scripts

Office 2003 Removal Utility

The command to manually start the script for the complete removal of Office 2003 components from the computer looks like this:

Cscript.exe "%OFFICEREMOVE%\2003\OffScrub03.vbs” ALL /Quiet /NoCancel /Force /OSE

removing office 2003 using offscrub vbs script

If the uninstallation task is run as an SCCM task, the removal program may look as follows:

"%SystemRoot%\System32\cmd.exe" /C "NativeCScript.cmd //B //NoLogo "2003\OffScrub03.vbs" ALL /Quiet /NoCancel /Force /OSE"

Office 2007 Removal Utility

The command to completely remove Office 2007 components:

Cscript.exe "%OFFICEREMOVE%\2007\OffScrub07.vbs” ALL /Quiet /NoCancel /Force /OSE

To run the script using the SCCM task:

"%SystemRoot%\System32\cmd.exe" /C "NativeCScript.cmd //B //NoLogo "2007\OffScrub07.vbs" ALL /Quiet /NoCancel /Force /OSE"

Office 2010 Removal Utility

The command to completely uninstall Microsoft Office 2010:

Cscript.exe "%OFFICEREMOVE%\2010\OffScrub10.vbs” ALL /Quiet /NoCancel /Force /OSE

When running in the Configuration Manager:

"%SystemRoot%\System32\cmd.exe" /C "NativeCScript.cmd //B //NoLogo "2010\OffScrub10.vbs" ALL /Quiet /NoCancel /Force /OSE"

Office 2013 Removal Utility

The command to completely remove Office 2013 MSI products:

Cscript.exe "%OFFICEREMOVE%\2013\OffScrub_O15msi.vbs” ALL /Quiet /NoCancel /Force /OSE

To run the script using the SCCM task:

"%SystemRoot%\System32\cmd.exe" /C "NativeCScript.cmd //B //NoLogo "2013\OffScrub_O15msi.vbs" ALL /Quiet /NoCancel /Force /OSE"

Office 2016 Removal Utility

The command to run the OffScrub script for the complete removal of Office 2016 MSI products on the current computer

Cscript.exe "%OFFICEREMOVE%\2016\OffScrub_O16msi.vbs” ALL /Quiet /NoCancel /Force /OSE

You can run Office 2016 uninstallation from the SCCM package using this command:

"%SystemRoot%\System32\cmd.exe" /C "NativeCScript.cmd //B //NoLogo "2016\OffScrub_O16msi.vbs" ALL /Quiet /NoCancel /Force /OSE"

Script to Uninstall Office Click to Run or Office 365

To remove Office Click to Run or Office 365 package, run this command:

Cscript.exe "%OFFICEREMOVE%\C2R\OffScrubc2r.vbs” ALL /Quiet /NoCancel /Force /OSE

To run the script using the SCCM task:

"%SystemRoot%\System32\cmd.exe" /C "NativeCScript.cmd //B //NoLogo "C2R\OffScrubc2r.vbs" ALL /Quiet /NoCancel /OSE"

Automatically Detecting the Version of MS Office

Remove-PreviousOfficeInstalls.ps1 is a PowerShell script from the Remove-PreviousOfficeInstalls project on Git that automatically detects the version and activation status of installed MS Office on a computer and calls the corresponding OffScrub scripts. With certain modifications, it can be used in the scenarios of automatic Office removal.

2 comments
0
Facebook Twitter Google + Pinterest
previous post
Fix: CDPUserSvc Has Stopped Working in Windows 10 / Windows Server 2016
next post
WER (Windows Error Reporting): How to Clear ReportQueue Folder in Windows

Related Reading

How to Install Only Specific Apps in Office...

September 25, 2020

Upgrading Windows 10 Build with Setup.exe Command-Line Switches

May 28, 2020

Outlook Keeps Asking For Credentials (Username and Password)

April 8, 2020

Office 2019 Deployment Guide for Enterprise Using Deployment...

March 23, 2020

How to Extend Office 2019/2016 & Office 365...

October 17, 2019

2 comments

Lorenzo June 5, 2019 - 10:13 am

June 5th 2019. It worked fine for me on a residual Office 365 32 bit installation that did not let me install the 64 bit version. Thank you very much.

Reply
Phil August 11, 2020 - 10:05 am

Say for example, I want to remove Office 2013 using SCCM, where would I put that command line?
“%SystemRoot%\System32\cmd.exe” /C “NativeCScript.cmd //B //NoLogo “2013\OffScrub_O15msi.vbs” ALL /Quiet /NoCancel /Force /OSE”

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • Preparing Windows for Adobe Flash End of Life on December 31, 2020

    January 22, 2021
  • Checking User Logon History in Active Directory Domain with PowerShell

    January 22, 2021
  • How to Disable/Remove Thumbs.db File on Network Folders in Windows?

    January 21, 2021
  • MS SQL Server 2019 Installation Guide: Basic Settings and Recommendations

    January 19, 2021
  • USB Device Passthrough (Redirect) to Hyper-V Virtual Machine

    January 15, 2021
  • Windows 10: No Internet Connection After Connecting to VPN Server

    January 13, 2021
  • Updating the PowerShell Version on Windows

    December 24, 2020
  • How to Enable and Configure User Disk Quotas in Windows?

    December 23, 2020
  • Restoring Deleted Active Directory Objects/Users

    December 21, 2020
  • Fix: Search Feature in Outlook is Not Working

    December 18, 2020

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Configuring KMS Server for MS Office 2019/2016 Volume Activation
  • Sending Emails from Excel using VBA Macro and Outlook
  • FAQ: MS Office 2013 KMS and Volume License Activation
  • How to Extend Office 2019/2016 & Office 365 Trial to 180 Days?
  • How to Check the Office 2016 / Office 365 License Activation Status
  • Office 2016 vs. Office 365: Differences and Licensing
  • Managing Microsoft Office Settings with GPO Administrative Templates
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top