Using Powershell to Determine Your Office Version

This guide provides a PowerShell script to determine whether the installed version of Microsoft Office is 32-bit or 64-bit. This is particularly useful for executing the appropriate installer based on the detected Office version.

Please note that this script does not account for Windows Store installations of Office.

The script works by accessing specific registry keys to retrieve the "Bitness" property. It checks both primary and alternate registry paths to ensure compatibility across different system configurations. Depending on the value of the "Bitness" property, the script then executes either a 32-bit or a 64-bit installer.

PowerShell Script

The following PowerShell script determines whether the installed Office version is 32-bit or 64-bit. This example is compatible with Office 2016, 2019, 2021, 2024 and 365, which all use the build number 16.0.

#start script
#Determine Office 32/64bit.
$bitness = get-itemproperty HKLM:\Software\Microsoft\Office\16.0\Outlook -name Bitness
if($bitness -eq $null) {
    $bitness = get-itemproperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook -name Bitness
}
 
If($bitness.Bitness -eq "x86")
{
    Write-Host "32 bit Office"
}
Else
{
    Write-Host "64 bit Office"
}
#end script

In case you need to use this against an older Microsoft Office, modify the '16.0' to a lower number.

Detailed Steps

  1. Retrieve Bitness Property:

    • The script first tries to get the "Bitness" property from HKLM:\Software\Microsoft\Office\<BUILD_NUMBER>\Outlook.
    • If the property is not found, it looks in HKLM:\SOFTWARE\WOW6432Node\Microsoft\Office\<BUILD_NUMBER>\Outlook.
  2. Determine Installer to Execute:

    • If the bitness property is "x86", it indicates a 32-bit installation, and the 32-bit installer is executed.
    • Otherwise, the 64-bit installer is executed.
    • Write-Host should be replaced by msi exec command.

Office Build Numbers

Depending on the Office version installed, the build number may vary. Here are the build numbers for different Office versions:

Office Version Build Number
Office 2010 14.0
Office 2013 15.0
Office 2016 16.0
Office 2019 16.0
Office 2021 16.0
Office 2024 16.0
Office 365 16.0

Was this article helpful?