# $COMPANY must be supplied by RMM $PRODUCT = 'O365ProPlusRetail' $BITNESS = '64' $MIGARCH = 'TRUE' $CHANNEL = 'SemiAnnual' $UPDATES = 'TRUE' $DISPLAY = 'None' # "None", "Full" $ACCEULA = 'TRUE' # Make changes if the system is 32bit If ( !(Is64Bit) ) { $BITNESS = '32'; $MIGARCH = 'FALSE' } $CONFIG = @" "@ # Set path to temp directory $TEMPDIR = '{0}microsoft-office-deployment' -f (Get-TempPath) # Recursively delete $TEMPDIR if it already exists If ( Test-Path $TEMPDIR ) { Write-Output """${TEMPDIR}"" already exists and will be deleted" Try { Remove-Item -Path $TEMPDIR -Recurse -Force -ErrorAction SilentlyContinue } Catch { Write-Error $_.Exception.Message } } # Create $TEMPDIR Write-Output "Creating: ${TEMPDIR}" Try { New-Item -Path $TEMPDIR -ItemType Directory -Force -ErrorAction Stop } Catch { Write-Error $_.Exception.Message ; Return } # Write $CONFIG to config.xml $CONFIGFILE = "${TEMPDIR}\config.xml" Try { $CONFIG | WriteToFile_UTF8NoBOM -FilePath "${CONFIGFILE}" } Catch { Write-Output "Cannot write configuration file! This script will exit." ; Write-Error $_.Exception.Message ; Return } # Set the name of ODT setup utility $ODT = "${TEMPDIR}\setup.exe" # Download ODT Write-Output "Downloading Office Deployment Tool" Download-File -URL 'https://www.emberkom.com/odt/setup.exe' -File $ODT # Install Office Write-Output "Installing Microsoft Office" Try { Start-Process $ODT -ArgumentList "/configure ""${CONFIGFILE}""" -Wait } Catch { Write-Error $_.Exception.Message } # Cleanup Write-Output "Deleting temp directory and its contents" Try { Remove-Item -Path $TEMPDIR -Recurse -Force -ErrorAction SilentlyContinue } Catch { Write-Error $_.Exception.Message }