This worklet will help migrate 32-bit version of Microsoft Office to 64-bit version.
Need to download Release history for Office Deployment Tool (ODT) - Office release notes | Microsoft Docs and open to get a copy of setup.exe
Next create an XML file called configuration-Ofice365-x64-MigrateArch.xml
<Configuration>
<Add OfficeClientEdition="64" MigrateArch="TRUE" Channel="Monthly" AllowcdnFallback="TRUE">
<Product ID="O365ProPlusRetail">
<Language ID="en-us" />
</Product>
</Add>
<Display Level="None" AcceptEULA="TRUE" />
<Logging Level="Standard" Path="C:\windows\temp" />
</Configuration>
Upload both setup.exe and configuration-Ofice365-x64-MigrateArch.xml to the worklet.
Evaluation
$workdir = "C:\ProgramData\Amagent\O365"
IF(Test-Path $workdir){ Remove-Item $workdir -recurse -force | out-null }
$scriptblock = {
Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration -Name Platform | Select-Object Platform
}
# Run the scriptblock and store results in the $64bit variable
$platform = & "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock
IF($platform.platform -eq 'x86'){
Exit 1
}else{
Exit 0
}
Remediation
$scriptblock = {
Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration -Name Platform | Select-Object Platform
}
# Run the scriptblock and store results in the $64bit variable
$platform = & "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock
IF($platform.platform -eq 'x86'){
# Setup Working Directory
$workdir = "C:\ProgramData\Amagent\O365"
IF(!(Test-Path $workdir)){mkdir $workdir | Out-Null}
# Copy setup files
Write-Host "Setup working directory at $workdir."
Copy-Item configuration-Office365-x64-MigrateArch.xml $workdir | Out-Null
Copy-Item setup.exe $workdir | Out-Null
# Migrate Office from 32-bit to 64-bit
Write-Host "Running Command $workdir\setup.exe /Configure configuration-Office365-x64-MigrateArch.xml."
Start-Process "$workdir\setup.exe" -ArgumentList "/Configure configuration-Office365-x64-MigrateArch.xml" -Wait
}else{
write-output "Detected $($platform.platform) as installed. Not running."
}