5

Office 365: Office 2016 Installation from USBKey using relative path

 3 years ago
source link: https://zoph.me/posts/2017-03-10-installation-office-2016-pro-plus-from-usbkey/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Mar 9, 2017

Office 365: Office 2016 Installation from USBKey using relative path

[30/04/17] Update: Following this post, I’ve pushed this script to Github if you want to contribute.

I was trying to use Office Deployment Tool (ODT) using the relative path for our Office 2016 ProPlus deployment (On USB Key & Hard Drive).

As USB Keys are mounted each time with different letters depending on how many devices already mounted. I was stuck cause ODT XML Configuration file does not support the relative path.

You can see this limitation on this page: here

To run this script on client computers, I’m using this simple launch cmd.

powershell.exe -ExecutionPolicy bypass -File .\path\install.ps1

The idea was to read and replace the line with SourcePath="Path" with the current dir. Quick and Dirty.

# Installation Office 2016 from USB Key
# VGR - 09/03/17

# Current folder of the running .ps1 file
$PS1dir = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition)

# Path of the configuration
$conf = "$($PS1dir)\conf_FR.xml"

# Current path with reformated end of XML line
$PS1dirEOL = "$($PS1dir)`">"

# Replace old line with the current folder
(Get-Content $conf) -replace '<Add OfficeClientEdition=.*', ('<Add OfficeClientEdition="32" Channel="FirstReleaseDeferred" SourcePath="'+$PS1dirEOL) | Set-Content $conf

# Running Office 2016 installation from new configuration file
$exec = "$($PS1dir)\setup.exe"
& $exec /configure $conf

That’s all folks!

zoph.


office365powershellautomation

199 Words

2017-03-09 20:31 +0000


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK