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 MSI 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.

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 365 16.0

PowerShell Script

Open the Start Menu by clicking on the Start button (Windows icon) in the bottom-left corner of your screen, or press the Windows key on your keyboard.

1. In the Start Menu search bar, type "PowerShell".

2. From the search results, click on Windows PowerShell or Windows PowerShell (x86), depending on your system's architecture.

3. Once PowerShell window opens, copy and paste the script below but make changes according to your build number as shown in the table above.

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

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

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.

Was this article helpful?