How to completely remove office 365 from a computer. Scripts to completely uninstall old versions of Office

23.02.2023 Social media

As part of the task of mass updating Office to the latest version on the computers of all users (according to the scheme), we needed to develop a simple solution for the correct automatic removal of any other versions of Microsoft Office previously installed on computers. It is supposed to use these scripts in tasks for automatic removal / installation of Office through SCCM packages.

In most cases, before installing a new version of Office, it is advisable to remove any versions of MS Office previously installed on the computer (simultaneous use of different versions of Office on the same computer is supported, but not recommended due to potential problems). Therefore, it became necessary to develop scripts that would correctly remove any version of Office previously installed on a PC.

VBS scripts OffScrub

After looking at several ways to remove previously installed versions of Office, we settled on using OffScrub scripts from Microsoft Premier Support. Scripts OffScrub are part of the packages of the official EasyFix packages (the package for forced removal of Office 2007 and 2010, if they cannot be removed in the standard way from the Control Panel) To remove Office 2013 and 2016, another tool is used - the package O15CTRRemove.diagcab, which also includes OffScrub scripts (see footnote just below)

Offscrub scripts are vbs scripts for automating the removal of products from Office. These scripts allow you to completely clean the system of traces of previously installed Office, regardless of its current performance. Here are the main advantages of using Offscrub to uninstall Office:

  • Ability to uninstall an older version even if the original installation files or the Office cache are missing or corrupted
  • The user hive in the registry is not affected
  • Provides complete removal
  • Remove obsolete settings and all products (including Project, Visio, Visio Viewer)

The script from the O15CTRRemove.diagcab package allows you to determine the installed version of Office and call the Offscrub*.vbs script for the corresponding version of Office.

First of all, you need to download the file from the Microsoft website FixIt for the versions of Office and Windows that are used in your infrastructure.

You can download the O15CTRRemove.diagcab package for different versions of Office and Windows from (https://support.microsoft.com/en-us/kb/971179).

Important note. Previously, this page contained 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, Windows 8 and Windows 10. In addition, back in the beginning of the year in the archive O15CTRRemove.diagcab there were Offscrub scripts for new versions of Office, now only PowerShell scripts remain in it. These (and other) versions of vbs Offscrub scripts can now only be obtained from the official Office Developer GitHub repository (OfficeDev).

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

Download the specified files and save to the C:\tools\OfficeUninstall directory. *.diagcab files are ordinary archives in CAB format that can be unpacked using the command expand.

So, for convenience, for each version of Office, we will create a separate directory:

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

Now, in each directory from the downloaded diagcab archives, we will unpack only vbs files.

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 same vbs files for new Office versions downloaded from GitHub.

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

Thus, we will have such vbs files:

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

The list of available arguments for any OffScrub vbs script can be obtained like this:

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

Features of running OffScrub vbs scripts via SCCM

In order for the Office uninstall script to work correctly on 64-bit versions of Windows, when you run them with a 32-bit Configuration Manager client, you need to run the appropriate version of cscript.exe. Therefore, on a 64-bit system, to run scripts, you need to run the cscript.exe processor from the C:\Windows\SysWOW64 directory.

This functionality can be achieved with a script. NativeCScript.cmd:

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

The finished archive with all the necessary files can be downloaded from our website: (1.4 Mb)

Clean uninstall script for Office 2003

The command to manually run the script to cleanly remove Office 2003 components on a computer will look like this:

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

If the uninstall job is run as an SCCM package, the uninstall command might look like this:

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

Clean uninstall script for Office 2007

Command to cleanly remove Office 2007 components for manual launch:

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

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

Clean uninstall script for Office 2010

Command to cleanly uninstall Microsoft Office 2010 for manual launch:

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

When launched through Configuration Manager:

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

Clean uninstall script for Office 2013

The command to completely remove Microsoft Office 2013 components for manual launch:

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

To run a script through an SCCM job:

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

Clean uninstall script for Office 2016

The command to manually run the script to completely remove Office 2016 components on the current one will look like this:

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

You can start uninstalling Office 2016 from the SCCM package with the following command:

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

Office Click to Run / Office 365 Clean Uninstall Script

Command to completely remove Office Click to Run / Office 365 components for manual launch:

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

To run a script through an SCCM job:

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

Automatic detection of Office version

The Remove-PreviousOfficeInstalls Git project also includes a script Remove-PreviousOfficeInstalls.ps1, which should automatically detect the version of MS Office installed on the computer and call one of the OffScrub-advising scripts. With certain modifications, it can also be used in Office uninstall scripts.

In the top ten, regardless of the edition, the developer embeds the Office 365 application suite, which is intended to become a replacement for the familiar Microsoft Office. However, this package is subscription-based, quite expensive, and uses cloud technologies, which many users do not like - they would prefer to remove this package and install a more familiar one. Our article today is designed to help you do just that.

The task can be solved in several ways - using a special utility from Microsoft or using the system uninstall tool. We do not recommend using uninstall software: Office 365 is tightly integrated into the system, and its removal by a third-party tool may disrupt its operation, and secondly, a third-party application will still not be able to remove it completely.

Method 1: Uninstall via Programs and Features

The easiest way to solve the problem is to use a tool "Programs and Features". The algorithm is the following:


This method is the simplest of all, and at the same time the most unreliable, because often the Office 365 package is not displayed in the specified snap-in, and an alternative tool must be used to remove it.

Method 2: Microsoft uninstaller utility

Users often complained about the inability to remove this package, so the developers recently released a special utility with which you can uninstall Office 365.

  1. Follow the link above. Click on the button "Download" and download the utility to any suitable place.
  2. Close all open applications, and office applications in particular, and then launch the tool. In the first window click "Further".
  3. Wait for the tool to do its job. Most likely, you will see a warning, click in it Yes.
  4. The message about successful uninstallation still does not say anything - most likely, a regular uninstallation will not be enough, so click "Further" to continue working.


    Use the button again "Further".
  5. At this point, the utility checks for additional problems. As a rule, it does not detect them, but if you have another set of Microsoft office applications installed on your computer, you will need to remove them too, because otherwise associations with all Microsoft Office document formats will be reset, and it is not possible to reconfigure them.

- it's automatic.

  • Right-click (RMB) on the Start icon and run the Control Panel command.
  • Select the "Programs and Features" section.
  • Left-click on Microsoft Office and select Uninstall.

If after this action, some folders related to this software package are found on the computer, you should use another method.

Manual removal of Office 2016:

id="a1">

Remember that manual uninstallation is a long and complicated process, so read the manual carefully!

The first step is to determine the installation type. To do this, launch any Office application and click on "File / Account". If the installation used Click-to-Run technology, you will see the update options. In the case of installation using an MSI package, updates can only be installed through the Windows Center.

Removing the "Click to Run" package:

  1. Locate the Office installation folder (most often located in C:\Program Files). Right-click on the folder and select the "Delete" command. Thus, we will remove the installation packages.
  2. To uninstall Office, you must get rid of the tasks scheduled by the program. To do this, open a command prompt window (with an administrator account) and enter the commands shown in the picture below, pressing Enter after each.

    Completing tasks using the manager: open the "Processes" section and if you see that the tasks indicated in the figure below are in the list, they should be completed.

  3. Next - delete the Office service (open a command prompt window and type "sc delete ClickToRunSvc", and confirm the action by clicking OK).
  4. Clear Start from program shortcuts.

If Office was installed via MSI, then uninstallation occurs using standard Windows system uninstallation tools.

  • A troubleshooter will start as it is a diagnostic utility. Next, select the “No” option, as the program will offer to restore applications.

  • In the next window, click "Uninstall a program" and wait for the process to complete.
IMPORTANT! After removing the software with this utility, you should run CCleaner and clean Windows 10 from old files.

Manual removal of the office program

In order to uninstall an office program from a Windows 10 system, it is worth doing a number of simple steps:

  • Initially, you need to check which version of the account is used on your PC. To do this, open any application, for example, Word, and select "File", "Account". If you see the Update Options button, the installation was a Click-to-Run. If there is no Update Options button, MSI was used.

  • Go to C:\Program Files\. Find the "Microsoft Office" folder. Right-click on it and select "Delete".
  • Now open a command prompt with Administrator rights and enter the following commands in order.

schtasks.exe /delete /tn "\Microsoft\Office\Office Automatic Updates"

schtasks.exe /delete /tn "\Microsoft\Office\Office Subscription Maintenance"

schtasks.exe /delete /tn "\Microsoft\Office\Office ClickToRun Service Monitor"

schtasks.exe /delete /tn "\Microsoft\Office\OfficeTelemetryAgentLogOn2016"

schtasks.exe /delete /tn "\Microsoft\Office\OfficeTelemetryAgentFallBack2016"

IMPORTANT! The method for Microsoft Office 2016 is described here. If you are using the 2010 version, then in the paths where 2016 is indicated, we indicate 2010.
  • Next, we complete all the processes that are associated with office applications.
  • Now you need to remove the program service. To do this, enter "sc delete ClickToRunSvc" on the command line.
  • Open the "ProgramFiles" folder and delete "Microsoft Office 16", "Microsoft Office".
  • Open "ProgramFiles(x86)" and delete the "Microsoft Office" folder.
  • Press "Win + R" and enter "%CommonProgramFiles%\Microsoft Shared". A new window will open. Delete the "ClickToRun" folder.
  • In the hidden folder "ProgramData" we find "Microsoft". Here we delete the folder "ClickToRun". Also, at ProgramData\Microsoft\Office, you need to find and delete the ClickToRunPackagerLocker file.
  • You also need to delete the registry branches:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppVISV

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Office - en-us

HKEY_CURRENT_USER\Software\Microsoft\Office

  • Launch Command Prompt with Administrator rights and type "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs". This command will remove all shortcuts from the start menu.
IMPORTANT! After removing the office software package, you need to restart the computer and start cleaning the system using any cleaner.

For information on how to remove the office suite from Windows 10, see the video: