Remotely Install Office ProPlus / Update Office Configuration on Client Computers with PowerShell
There are some immediate perks for using PowerShell to either install an application on remote computers or update an applications configuration remotely. In this post I will do several things, Install Office 365 ProPlus to a remote computer, and update the configuration of Office 365 ProPlus on the remote machine, having it go from the Monthly channel to the Semi-Annual channel and also removing groove.exe and lync.exe (Skype for Business).
When updating the configuration the install is silent and the EULA is accepted by setting <Display Level=“None” AcceptEULA=“TRUE”/>. When you set FORCEAPPSHUTDOWN to false, Office applications can be used during the upgrade but its recommended to restart the client workstation at the end of the install. I have also seen it not able to update if certain office applications are running. It’s recommended to set FORCEAPPSHUTDOWN to TRUE to close the office applications while they update.
To get the configuration.xml document and setup.exe you will need to download the Office Deployment Tool which can be downloaded from here and here. Store both these files in a spot you can call later. For me I placed them at C:\Transfer
To make my configuration.xml file I created the XML using the site here.
In the end my configuration.xml file looked like the following:
<Configuration> <Add OfficeClientEdition="32" Channel="Monthly"> <Product ID="O365ProPlusRetail"> <Language ID="en-us"/> <ExcludeApp ID="Lync"/> <ExcludeApp ID="Groove"/> </Product> </Add> <Updates Enabled="TRUE" Channel="Monthly"/> <Display Level="None" AcceptEULA="TRUE"/> <Property Name="FORCEAPPSHUTDOWN" Value="TRUE"/> <Property Name="SharedComputerLicensing" Value="0"/> <Property Name="PinIconsToTaskbar" Value="TRUE"/> </Configuration>
When I ran this remotely it seemed that client computers did not properly update unless FORCEAPPSHUTDOWN was set to TRUE.
In the ExcludeApp I am removing Lync (Skype for Business) and Groove (old OneDrive Sync Agent). If you are installing this fresh it will not install either application.
Below is a table of the XML values and the description of them:
Value | Description |
---|---|
Add SourcePath=”\Server\Share” | Office will be downloaded to “\server\share” on your network and deployed using installation files at that location. |
Add OfficeClientEdition=”32″ | Downloads and installs the 32-bit edition of Office |
Add Channel=”Broad” | Office will be installed using the Semi-Annual Channel. |
Product ID=”O365ProPlusRetail” | Downloads and installs Office 365 ProPlus. |
Language ID=”en-us” Language ID=”ja-jp” |
Downloads and installs English and Japanese versions of Office. |
Updates Enabled=”TRUE” | Office will check for updates. |
Updates UpdatePath=”\Server\Share” | Office checks for updates at “\server\share” on your network. |
Updates Channel=”Broad” | Office updates using the Semi-Annual Channel. |
Display Level=”None” AcceptEULA=”TRUE” | When installing Office, no user interface is displayed. |
Logging Level=”Standard” Path=”%temp%” | Log files are stored in the %temp% folder. |
Once you have built your configuration.xml file to contain the preferences you require, you can run the following PowerShell command on client computers:
set-location "C:\Transfer\"; .\setup.exe /configure configuration.xml
In this command you are changing the location to where you stored your files, calling the setup.exe installer and telling it to use your configuration.xml file.
But lets say you don’t want to manually copy the files over to every computer, call the exe, and configuration file, how can you remotely install office using this config (if Office is not installed already) or update the Office config (if it’s installed on the client workstation already)?
Using PowerShell, we can install Office / Update Office remotely on as many computers as we want without ever having to go to the users workstation. We can update many workstations in parallel which lets us update groups of computers at a single time. If we want to check the install status on several computers, or a specific computer, we can look up the status of the PowerShell job.
#Get computers to install office on $Computers = (Get-ADComputer -Filter * -SearchBase "OU=Computers,OU=MyBusiness,DC=Bwyatt,DC=com").Name ForEach ($Computer in $Computers) { Write-Host "Working on $Computer" -ForegroundColor White Write-Host "Testing access to $Computer" -ForegroundColor White $HostUp = Test-Connection -ComputerName $Computer -BufferSize 12 -Count 1 If (!($HostUp)) { Write-Warning -Message "Remote Host is not accessible!" } Else { Write-Host "Success!" -ForegroundColor Green $items = Get-Item -Path C:\Transfer\* Write-Host "Creating Transfer folder on $Computer" -ForegroundColor Yellow New-Item -Path \\$computer\c$\Transfer -ItemType Directory -ErrorAction SilentlyContinue | Out-Null foreach ($item in $items) { Write-Host "Copying $Item over to $Computer\c$\Transfer\" -ForegroundColor Yellow Copy-Item -Path $item -Destination \\$Computer\C$\Transfer\ -Force } Write-Host "Starting setup on $Computer" -ForegroundColor White Invoke-Command -ScriptBlock { set-location "C:\Transfer\"; .\setup.exe /configure configuration.xml } -ComputerName $Computer -AsJob } } Get-Job | Format-Table
In my script I am going to install Office on all the Computers in the Chicago office by telling PowerShell to first get all Computers in the Computers OU which is nested in the Chicago OU. It then takes the array of computers and for each computer it will do the following:
- Get all items located in “C:\Transfer”. This is looking on the server I am running this script from. I have my configuration.xml and setup.exe located here
- Check to see if each computer is accessible, if not display a warning and move to the next computer
- Create a new directory on the client computer at C:\ called Transfer so the client computer will also have C:\Transfer
- Copy all items from the first step to the client computer in the newly created directory at C:\Transfer
- Start a new PowerShell job which will run the following command: set-location “C:\Transfer\”; .\setup.exe /configure configuration.xml
Since we are adding the AsJob parameter at the end, PowerShell will not wait for the .exe to start, and finish installing before moving to the next computer, it will create a PowerShell job for each computer, this allows us to update multiple computers in parallel.
You can get the status of each computer’s PowerShell job by running Get-Job on the computer you run this from. In my example above we can see that two computers have finished installing/updating Office and it is still installing/updating on WT-LT-02.
On the client workstation you will see several Office processes during the install, when doing it remotely I saw only 2 processes which did not include the OfficeC2RClient process.
My name is Bradley Wyatt; I am a 4x Microsoft Most Valuable Professional in Cloud and Datacenter Management. I have given talks at many different conferences, user groups, and companies throughout the United States ranging from PowerShell to DevOps Security best practices and am the 2022 North American Outstanding Contribution to the Microsoft Community winner.
2 thoughts on “Remotely Install Office ProPlus / Update Office Configuration on Client Computers with PowerShell”
This looks really good and really helpful. I used this as a starting point for my own install of Office via the ODT and PowerShell.
A quick note. In the PowerShell script you display you are still using the Monthly channel from what I can tell.
Awesome man! I’ve toyed around with several scripts, but this is the first one (with a couple tweaks for our configuration) that worked SEAMLESSLY!
Great job! And THANKS!
🙂