Jump to content
kelliott

Office purge and replace with 365 script

Recommended Posts

I have just completed a office purge and replace with 365 script that I feel may be useful to the wider community. 

This script will determine the version installed, purge it and then install a fresh copy of 365 in "Shared Computer Activation Mode". If you don't want or need shared computer activation mode, edit the file configuration.xml in the Office-365-business-retail.zip and remove these lines

	    <Property Name="SharedComputerLicensing" Value="1" />
    <Property Name="SCLCacheOverride" Value="1" />
    <Property Name="SCLCacheOverrideDirectory" Value="%userprofile%\microsoft\" />
	

To change edition installed, replace the product ID with one of the following:

Office 365 plan Product ID
Office 365 ProPlus 
Office 365 Enterprise E3
Office 365 Enterprise E4
Office 365 Enterprise E5
Office 365 Midsize
O365ProPlusRetail
Office 365 Business
Office 365 Business Premium
O365BusinessRetail
Office Small Business Premium O365SmallBusPremRetail


Delete any excluded apps you want to be installed from the block below

	        <Language ID="MatchOS" Fallback="en-us" />
        <ExcludeApp ID="Lync" />
        <ExcludeApp ID="Publisher" />
        <ExcludeApp ID="Groove" />
        <ExcludeApp ID="OneDrive" />
        <ExcludeApp ID="OneNote" />
        </Product>
	

It also places updates on the "broad" track, so not bleeding edge, but not "disable all updates either"

 

 

 

 

 

Office_purge_and_replace.zip

Edited by kelliott
See change log in 2nd reply.
  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites

Corrected issue with some versions of offscrub being coded to work from system32 and no copies of the scripts existing there

Added changelog to the Readme (with dates) to ensure you can easily see if you're using the latest version.

Share this post


Link to post
Share on other sites

Due to the changes, please make sure you replace ALL files with the updated version. Many have had changes and it will not work if several are not replaced.

 

Changes:
6-28-18: 
- Corrected issue with 2016 not being removed correctly
- Corrected issue with language locales not being detected at all
- Created secondary removal type, one will remove all office, including Visio & Project, the other will only remove the main office suite. Ensure you pick the correct one for your deployment. 
--- To pick what version you want, change line 67's source file from "Remove-PreviousOfficeInstalls-MainProductOnly.zip" to "Remove-PreviousOfficeInstalls-All.zip"
- Created additional deploy scripts for presets
- Created non Shared computer activation version of template - This version is preconfigured in the "All Apps" version of the script
- Enabled process logging to c:\windows\temp\offscrub.txt
- Corrected issue with one office installer extract going to an incorrect folder

8-30-18:

- Corrected check for completion, previously a * was used to close out the Office 365 detection, this was incorrect, and was correctly changed to a %. 
Credit to @Jacobsa for catching this. 

 

Edited by kelliott

Share this post


Link to post
Share on other sites

awesome thanks!  FYI in the ProPlus script (all apps), your download location and unzip location are named incorrectly to Business-Retail which might add confusion.

Share this post


Link to post
Share on other sites

Great work here mate, thanks for sharing. I found something else as well. The detection of Office 365 existing on the PC already was off for me. Needed to search for:

Microsoft Office 365 ProPlus - en-us
Microsoft Office 365 Business - en-us

I checked over our managed machines, they all look like that.

  • Like 1

Share this post


Link to post
Share on other sites

So I figured out something else. Part of the script was searching for 'Microsoft office 365*'. I didn't realise you can do wildcards there, and you can, you just need to use % instead of * like the other parts of the script. 

Have changed it to do that instead now and it works well. 

Share this post


Link to post
Share on other sites

Just found this and its exactly what I needed. Props @kelliott have there been any changes to the script? I want to put this int he download script section of the site and want to make sure you don't have an improved version :)

 

Share this post


Link to post
Share on other sites

@MGreen Hasn't been any changes in a bit to it, been solid for me for the deployment I wrote it for. We did run in to about 10 that it failed on  (out of 200ish) due to an issue of a stub version of office being on there 

On those ones I split out the install into yet another script, and then submitted to those to install and get them caught up.

 

@Jacobsa - were you having it look for an additional set, or is it the validation part that failed for you? 

 

@timbo83251 yeah, I did that to avoid problems in other spots. It extracted clean, but in the end it's a generic installer anyway.

Edited by kelliott

Share this post


Link to post
Share on other sites

See third post for newest change log and top post for newest file. Reviewed script and identified what @Jacobsa was referring to. Thanks for spotting the bug!

Share this post


Link to post
Share on other sites

Anyone ever seen an issue with removing Office 2010 Home & Business with this? I can't get it to remove that version no matter what I do! Debugging sees the script get to the powershell command to remove it, but it doesn't manage to remove it.

It's driving me nuts!

Share this post


Link to post
Share on other sites
On 11/29/2018 at 8:01 AM, kkevgreen said:

Anyone ever seen an issue with removing Office 2010 Home & Business with this? I can't get it to remove that version no matter what I do! Debugging sees the script get to the powershell command to remove it, but it doesn't manage to remove it.

It's driving me nuts!

I ran into the same issue with removing the "HomeBusinessRetail" SKU on Office 2013 and 2016, as well. I've informed @kelliott of the issue via slack.

Share this post


Link to post
Share on other sites
On 11/29/2018 at 11:01 AM, kkevgreen said:

Anyone ever seen an issue with removing Office 2010 Home & Business with this? I can't get it to remove that version no matter what I do! Debugging sees the script get to the powershell command to remove it, but it doesn't manage to remove it.

It's driving me nuts!

There's a change needed to the offscrub.vbs files. It seems MS missed that one when they published the initial release. 

 

@Leapo gave me good feedback via slack (this is the easiest way to reach me), just need to find time to correct the offscrub files and republish it. 

 

I've added a quick change to the offscrub files. I haven't run into that SKU in the wild, so if someone could replace their copy of this file with my new one and let me know if it resolves the issue I'd appreciate it. 

Remove-PreviousOfficeInstalls.ps1

Edited by kelliott
Added corrected PS1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×