04-18-2024 09:42 AM
Hello hello,
Reposting this one from the JumpCloud Slack Lounge. Loic B. shared how he deployed Office to his devices via JumpCloud commands:
$URL = "https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_17328-20162.exe"
$Path = "C:\Windows\Temp\officedeploymenttool_17328-20162.exe"
Invoke-WebRequest -URI $URL -OutFile $Path
cd C:\WINDOWS\Temp\
.\officedeploymenttool_17328-20162.exe /quiet /extract:office
Start-Sleep -Seconds 5
cp C:\WINDOWS\Temp\office2021_pro_plus_v3.xml C:\WINDOWS\Temp\office\office2021_pro_plus_v3.xml
Start-Sleep -Seconds 5
cd C:\WINDOWS\Temp\office\
.\setup.exe /configure .\office2021_pro_plus_v3.xml
Note: You can add PIDKEY="xxxxxxxxxx" after Product ID)
<Configuration ID="xxxxxxxxxxxxxx">
<Add OfficeClientEdition="64" Channel="MonthlyEnterprise" Version="16.0.14827.20220">
<Product ID="ProPlus2021Retail">
<Language ID="fr-fr" />
<Language ID="MatchOS" />
<ExcludeApp ID="Access" />
<ExcludeApp ID="Lync" />
<ExcludeApp ID="OneDrive" />
<ExcludeApp ID="OneNote" />
<ExcludeApp ID="Outlook" />
<ExcludeApp ID="Publisher" />
</Product>
</Add>
<Property Name="SharedComputerLicensing" Value="0" />
<Property Name="FORCEAPPSHUTDOWN" Value="TRUE" />
<Property Name="DeviceBasedLicensing" Value="0" />
<Property Name="SCLCacheOverride" Value="0" />
<Property Name="AUTOACTIVATE" Value="1" />
<Updates Enabled="TRUE" />
<RemoveMSI />
<AppSettings>
<User Key="software\microsoft\office\16.0\excel\options" Name="defaultformat" Value="51" Type="REG_DWORD" App="excel16" Id="L_SaveExcelfilesas" />
<User Key="software\microsoft\office\16.0\powerpoint\options" Name="defaultformat" Value="27" Type="REG_DWORD" App="ppt16" Id="L_SavePowerPointfilesas" />
<User Key="software\microsoft\office\16.0\word\options" Name="defaultformat" Value="" Type="REG_SZ" App="word16" Id="L_SaveWordfilesas" />
</AppSettings>
</Configuration>
I have something similar, but I use a $URL that is retrieved dynamically to avoid the link changing depending on the version. If others are interested, you can also generate your own XML configuration files at https://config.office.com/officeSettings/configurations and use them in the script as follows:
$ErrorActionPreference="SilentlyContinue"
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$TEMP = "C:\Windows\Temp\ODT"
$ID = (Invoke-WebRequest -UseBasicParsing -Method Get -Uri "https://go.microsoft.com/fwlink/p/?LinkID=626065" -MaximumRedirection 0 -EA SilentlyContinue).Headers.Location.split('=')[-1]
$LIST = (Invoke-WebRequest -UseBasicParsing -Uri "https://www.microsoft.com/en-us/download/confirmation.aspx?id=$ID" -ErrorAction SilentlyContinue).links
$URL = ($LIST | Where-Object {$_.outerHTML -like "*click here to download manually*"}).href
$XML = "https://deploymentconfigstorage.blob.core.windows.net/deploymentconfig/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xml?sv=xxxx-xx-xx&sr=b&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&st=xxxx-xx-xxxxxxxxxxxxxxxx&se=xxxxxxxxxxxxxxxxxxxxxxxx&sp=r"
[System.IO.Directory]::CreateDirectory("$TEMP") | Out-Null
Invoke-WebRequest -Uri $URL -OutFile "$TEMP\officedeploymenttool.exe"
Start-Process "$TEMP\officedeploymenttool.exe" -ArgumentList "/extract:`"$TEMP`" /quiet" -NoNewWindow -Wait
Start-Process "$TEMP\setup.exe" -ArgumentList "/configure `"$XML`"" -NoNewWindow -Wait
[System.IO.Directory]::Delete("$TEMP",$true) | Out-Null
Happy Deploying!
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.