The customized MS Office 2016 package can be installed on multiple remote computers like windows 10 workstations or server operating systems using a simple Powershell script.
Assuming you have extracted the office 2016 ISO file and customized the package, also created the .MSP file in same location where all office 2016 files are stored (network share or any other storage location).
I have created a batch file to install the ms office 2016 with my customized package, I’m going to save in C:\software\Office2016\ on the remote computers, basically I’m copying this batch file along with all content of ms office 2016 you can store to wherever you want, see the example of batch file.
We need to create another file for storing all the servers or multiple machines list, I named it as Allservers.txt and saved it in my local machine c:\temp\Allservers.txt
#remote machines list
$machines= Get-Content -Path "C:\temp\AllServers.txt"
foreach ($onemachine in $machines)
{
# Copying the ms office 2016 along with batch file
$path = "C:\software\"
If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path }
$path = "C:\software\Office2016"
If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path }
Copy-Item -Path "\\fileserver\software\Office2016\*" -Destination "\\$onemachine\c$\software\Office2016" -Recurse -force
Invoke-command -ComputerName $onemachine -Scriptblock {C:\software\Office2016\officeinstall.bat} -Asjob
}
The above script copies the ms office files from a fileserver to all remote computers in C:\software\Office2016, if this folder doesn’t exist then the script creates this folder path and copies the files.
The script call the batch file officeinstall.bat on each server and runs it in the background, wait for all jobs to complete, to get the running job status, use the command get-job -state running.
I hope you find this article useful if you have any questions please let us know.
Thank you for visiting my site, for any scripts in these articles you are testing please make sure you have tested this script in our lower environment before you run in production.
Leave a Reply Cancel reply