Recently, we performed an upgrade of our Microsoft Office Suite. We had Office 2010 installed on all user machines, and we were switching to Office 2013.
However, we didn’t want to go around to each user and manually uninstall Office 2010 (since we wanted Office 2013 to have a clean install, we couldn’t do a normal upgrade). So I had to devise a way to uninstall Office 2010 with minimum input and effort on behalf of the users.
The easiest way to perform an unattended uninstall of Office is via combination of .bat file and edits to a .xml file. Don’t worry, you don’t need experience in code in order to do this – I certainly didn’t!
First, you must extract the Office 2010 installation media to a shared network location that is accessible to everyone. This is important, as your batch file will reference it. In our case, we were lucky, as the vast majority of our users were using MS Office 2010 with SP1, x64 edition. So, it was fairly easy for me to create a network share and copy the CD there.
Next, you have to create the batch file. This is easier than it seems. Open a Notepad document, type your code, when do a File>Save As and name it something like “UninstallOffice.bat”.
Below is a sample one, for Office 2010 Pro:
@ECHO OFF ECHO PLEASE CLOSE ALL OPEN OFFICE PROGRAMS (Including Outlook, Word and Excel).
ECHO Removing Office 2010….
“\\server\shared drive\Office 2010 Pro\setup.exe” /uninstall ProPlus /config “\\server\shared drive\Office 2010 Pro\ProPlus.WW\UninstallConfig.xml”
ECHO Uninstall Complete, please reboot your computer now
Let me break down the code here so you can edit it as necessary:
- @ECHO OFF – This line basically prevents the command prompt’s version and path information from showing up. For example, when you run this code, instead of this:
You get this instead:
It’s a lot cleaner and easier to read.
- ECHO Please close all Office programs (Including Outlook, Word and Excel) – This line is optional. The ECHO command prints to screen anything after it; that’s why the “Please close….” line is shown above. This line can be edited as necessary or deleted.
- PAUSE – This line pauses the batch file and inserts the “Press any key to continue….” line shown above. This is optional; I inserted it to make sure that the users read the notice about closing all Office programs, and then they can continue the batch file after they have done so.
- ECHO Removing Office 2010…. – This line is printed to screen just to show the user what the batch file is doing.
- “\\server\shared drive\Office 2010 Pro\setup.exe” /uninstall ProPlus /config “\\server\shared drive\Office 2010 Pro\ProPlus.WW\UninstallConfig.xml” – This line does several things.
- First, the “\\server\shared drive\Office 2010 Pro\setup.exe” part of the line is pointing toward your network shared folder where you extracted the data from the Office CDs. Note the quotation remarks around the file string; these are necessary if there are any spaces in the file string, like between the words Office and 2010.
- /uninstall ProPlus is stating to use the setup.exe file designated in the first part of the line to uninstall the product. ProPlus is the version of Office we are using in this example; in order to determine what version you have, if you look in the extracted files, there should be a folder named “proplus.ww” or “pro.ww”. In that folder there is a config.xml file. If you open it in Notepad, the first line will be or something similar. In fact, keep this file open, you will need it later.
- “\\server\shared drive\Office 2010 Pro\ProPlus.WW\UninstallConfig.xml” points to the location of the configuration file for the uninstall. I’ll explain more about that in a bit; for now, I suggest you use the “UninstallConfig.xml” filename.
- The last two lines, ECHO Uninstall Complete, please reboot your computer now and PAUSE are optional (with the purpose of ECHO and PAUSE having been explained above) but suggested.
Now just save your batch file (make sure to change the extension to .bat).
The last thing you need to do is edit that Config.xml file we had open. My suggestion is to do a File > Save As and name it “UninstallConfig.xml”; make sure to save it in the same folder. Now, we’re going to edit it.
All the lines that start with “<!–” are comments. Those can safely be deleted. After that, you should just have:
You’re going to want to add the code for uninstalling the program here. I suggest the following:
<Display Level="basic" CompletionNotice="yes" SuppressModal="no" AcceptEula="yes" />
<Setting Id="SETUP_REBOOT" Value="Always" />
This does several things: It does an automatic uninstall, shows a completion notice, and prompts for a reboot when finished. It only shows the basic information and prompts needed, and takes the onus of making a lot of choices off the users. If you want more information on the various options and switches that can be used, you can find it in Microsoft’s TechNet here.
Now, all you need to do is publish the .bat file somewhere users can access it, and send out an email asking them to run the program to uninstall Office!
Are you looking for a quick, easy way to push out a deployment of Office? Check out my blog article: Personalize your Microsoft Office Suite Deployment with the Customization Tool!