Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mkdir C:\OfficeSetup -EA SilentlyContinue
- Set-Location -Path 'C:\OfficeSetup'
- $CurrentDir = $(get-location).Path;
- Set-Location $CurrentDir
- $Key = Read-Host -Prompt 'Please paste the key here'
- $Note = "PIDKEY="
- $PIDKEY = [string]$Note + '"' + $Key + '"'
- Set-Content -Path "$CurrentDir\config1.xml" -Value {
- <Configuration>
- <Info Description="Office Professional Plus 2019 (32-bit)" />
- <Add OfficeClientEdition="32" Channel="PerpetualVL2019" SourcePath="C:\OfficeSetup">
- <Product ID="ProPlus2019Volume" PIDKEY>
- <Language ID="en-us" />
- </Product>
- </Add>
- <RemoveMSI />
- <Display Level="Full" AcceptEULA="TRUE" />
- <Property Name="AUTOACTIVATE" Value="1" />
- </Configuration>
- }
- $findString = 'PIDKEY'
- (Get-Content "$CurrentDir\config1.xml") | foreach {$_.replace($findString,$PIDKEY)} | Set-Content -Path "C:\OfficeSetup\config.xml"
- Remove-Item -Path "$CurrentDir\config1.xml"
- Unblock-File -Path $CurrentDir\officedeploymenttool_12827-20268.exe
- Start officedeploymenttool_12827-20268.exe /extract:C:\OfficeSetup
- sleep 5
- $wshell = New-Object -ComObject wscript.shell;
- $wshell.AppActivate('The Microsoft Office 2016 Click-to-Run Administrator Tool')
- Sleep 3
- $wshell.SendKeys('{TAB}')
- $wshell.SendKeys('{TAB}')
- $wshell.SendKeys(' '); Sleep 1
- $wshell.SendKeys('{TAB}')
- $wshell.SendKeys('~'); Sleep 1
- $wshell = New-Object -ComObject wscript.shell;
- $wshell.AppActivate('The Microsoft Office 2016 Click-to-Run Administrator Tool')
- $wshell.SendKeys('~'); Sleep 1
- Set-Location C:\OfficeSetup
- cmd /c Setup.exe /download config.xml
- cmd /c Setup.exe /configure config.xml
- Start-Sleep -Seconds 30
- Get-ChildItem * -Recurse | Remove-Item ; Sleep 2
- Set-Location $CurrentDir
- &cmd.exe /c rd /s /q C:\OfficeSetup
- Remove-Item -Path "$CurrentDir\OfficeSetup.ps1"
Add Comment
Please, Sign In to add comment