Skip to content

Instantly share code, notes, and snippets.

@1mm0rt41PC
Last active January 25, 2023 22:11
Show Gist options
  • Save 1mm0rt41PC/6c5f758f7010561450ce48ae389be5f3 to your computer and use it in GitHub Desktop.
Save 1mm0rt41PC/6c5f758f7010561450ce48ae389be5f3 to your computer and use it in GitHub Desktop.
DeployOffice2019
# iwr https://gist.githubusercontent.com/1mm0rt41PC/6c5f758f7010561450ce48ae389be5f3/raw/DeployOffice2019.ps1 | out-string | iex
#choco.exe install -y office2019proplus --params "/Language:fr-FR"
function install_office2019( $key ){
$url = 'https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_15928-20216.exe'
$checksum = '12B4CF116CA332C59BABC9A99EF6505BB659EA7623E6F1A71AF04F47A772A8DB'
$conf = @'
<Configuration>
<Add OfficeClientEdition="64" Channel="PerpetualVL2019" AllowCdnFallback="True">
<Product ID="ProPlus2019Volume">
<Language ID="fr-FR" />
<Language ID="MatchInstalled" />
<Language ID="MatchOS" Fallback="en-us" />
</Product>
<Product ID="ProofingTools">
<Language ID="it-it" />
<Language ID="en-us" />
</Product>
</Add>
<Updates Enabled="TRUE" />
<Logging Level="Standard" Path="%temp%" />
<RemoveMSI All="TRUE"/>
<Display Level="None" AcceptEULA="TRUE" />
</Configuration>
'@
$xtmp = $(New-TemporaryFile).fullname
$officetempfolder = $xtmp+'.Office2019ProPlus'
$officetempexe = $xtmp+'.Office2019ProPlus.exe'
if( (Get-Item 'C:\Program Files*\Microsoft Office\root\Office16\WINWORD.EXE').count -eq 0 ){
curl.exe $url --output $officetempexe
if( (Get-FileHash -Algorithm SHA256 $officetempexe).Hash -eq $checksum ){
& $officetempexe /extract:`"$officetempfolder`" /log:`"$officetempfolder\OfficeInstall.log`" /quiet /norestart
$conf | out-file -encoding utf8 $officetempfolder\configuration.xml
& "$officetempfolder\Setup.exe" /configure $officetempfolder\configuration.xml
}
Remove-Item -Recurse -Force "$officetempfolder"
Remove-Item -Recurse -Force "$officetempexe"
$vbs=(Get-Item 'C:\Program Files*\Microsoft Office\Office16\ospp.vbs')[0].FullName ;
cscript $vbs /inpkey:$key ; cscript $vbs /act ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment