2

Programmatically, what method can get the name of the installed Microsoft Office version? I have tried every Powershell command, VBScript, and WMI query I could find. I have pored through the registry and the file system, and I can find no perfect method for collecting the installed Office version.

The closest method I was able to come up with was using a WMIC query:

wmic product where "Name like '%Office%'" get name, version

Unfortunately, this returns a varying array of applications, and even if more finely filtered, it doesn't tell me if "Office 16" is "Pro", "Professional Plus", or "Office365".

Otherwise, the registry value at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Scenario\INSTALL\ProductstoAdd

It exists at least on version 2016, but not with older versions. And it, itself, doesn't contain a friendly name, so further scripting would be necessary to convert data of ProPlusRetail.16_en-us_x-none to "Office 2016 Professional Plus" or O365BusinessRetail.16_en-us_x-none to "Office 365 Business (2016)"

I'm hoping that someone has an easier methodology than many if/else if/else if statements in a huge script.

4
  • Try something from this answer
    – DrZoo
    Oct 29, 2016 at 2:33
  • That methodology only returns the "Year" of the Office version. As noted, I need to determine further the product such as "Office 2016 Professional Plus" or "Office 365 Business (2016)".
    – Beems
    Oct 31, 2016 at 12:49
  • superuser.com/questions/1097079/… This script seems pretty solid, however it doesnt tell you which license version is installed...
    – Kage
    Oct 31, 2016 at 19:19
  • I looked at that one. Unfortunately, it does not determine the difference between "Office 2016 Professional Plus" and "Office 365 Business (2016)". Since this question was downvoted, I've been forced to write an entirely new detection script in Powershell that involves dozens and dozens of different mechanisms to get specific, named versions.
    – Beems
    Oct 31, 2016 at 19:23

7 Answers 7

3

You can find a name of installed Microsoft Office in registry. The process may be automated following the steps:

Check the registry keys
for 32-bit versions:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
for 64-bit versions:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

If a key matches one of the Product ID patterns, as per Description of the numbering scheme for product code GUIDs in Office 2016, 2013, 2010, 2007, 2003, XP, 2000, then read DisplayName Key Value, which is actually the name of installed Office.

Also I found Robust Office Inventory Scan Tool (ROISCAN), that performs quite full search for installed Microsoft Office versions.

1
  • 1
    Thanks! I did not realize the Office GUIDs were not randomized. That will definitely help with detection.
    – Beems
    Nov 10, 2016 at 17:29
2

As a possible option try this Poswershell query:

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail* | Select-Object DisplayName, DisplayVersion, Publisher
1
  • That's the build number, not the version number.
    – Strill
    Dec 23, 2021 at 19:18
1

Try this:

setlocal enableDelayedExpansion
for /f "tokens=2 delims==" %%O in ('ftype ^|findstr /r /I "\\OFFICE[0-9]*" 2^>nul') do (
    set "verp=%%~O"
    goto :end_for
)
:end_for

for %%P in (%verp%) do (
    set "off_path=%%~dpP"
    for %%V in ("!off_path:~0,-1!") do (

     set "office_version=%%~nV"
     goto :end_for2
    )
)
:end_for2

if [%office_version%] == [] echo No Office installed & goto end
echo %office_version%

:end
endlocal
1

Just sharing a method that worked for me

$Keys = Get-Item -Path HKLM:\Software\RegisteredApplications | Select-Object -ExpandProperty property
$Product = $Keys | Where-Object {$_ -Match "Excel.Application."}
$OfficeVersion = ($Product.Replace("Excel.Application.","")+".0")
Write-Host $OfficeVersion

Hope this helps someone else.

1

I wrote this script, it's based on the version of excel.exe. It then reads the name and version from registry.


$x32 = ${env:ProgramFiles(x86)} + "\Microsoft Office"
$x64 = $env:ProgramFiles + "\Microsoft Office"
$OK = $true


if (Test-Path -Path $x32) {$Excel32 = Get-ChildItem -Recurse -Path $x32 -Filter "EXCEL.EXE"}
if (Test-Path -Path $x64) {$Excel64 = Get-ChildItem -Recurse -Path $x64 -Filter "EXCEL.EXE"}
if ($Excel32) {$Excel = $Excel32}
if ($Excel64) {$Excel = $Excel64}
if ($Excel32 -and $Excel64) {"Error: x32 and x64 installation found." ; $Excel32.Fullname ; $Excel64.Fullname ; $OK = $false}
if ($Excel.Count -gt 1) {"Error: More than one Excel.exe found." ; $Excel.Fullname ; $OK = $false}
if ($Excel.Count -eq 0) {"Error: Excel.exe not found." ; $OK = $false}


if ($OK) {
   $DisplayVersion = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" -Name "DisplayVersion" -ErrorAction SilentlyContinue | Where-Object {$_.DisplayVersion -eq $Excel.VersionInfo.ProductVersion -and $_.PSChildName -notlike "{*}"}
   $Office = Get-ItemProperty -Path $DisplayVersion.PSPath
   $Office | ForEach-Object {"Product: " + $_.DisplayName + $(if ($_.InstallLocation -eq $x32) {", 32 Bit"} else {", 64 Bit"})  + ", Productversion: " + $_.PSChildName + ", Build: " + $_.DisplayVersion}
}

I get this outputs on different systems. An emtpy line is the separator between the various outputs.


Product: Microsoft Office Professional Plus 2019 - de-de, 64 Bit, Productversion: ProPlus2019Retail - de-de, Build: 16.0.14430.20306

Product: Microsoft Office Professional Plus 2019 - de-de, 64 Bit, Productversion: ProPlus2019Volume - de-de, Build: 16.0.10379.20043

Product: Microsoft 365 Apps for Enterprise - de-de, 64 Bit, Productversion: O365ProPlusRetail - de-de, Build: 16.0.14430.20306

Product: Microsoft Office Professional Plus 2019 - de-de, 64 Bit, Productversion: ProPlus2019Volume - de-de, Build: 16.0.10379.20043
Product: Microsoft Office Profesional Plus 2019 - es-es, 64 Bit, Productversion: ProPlus2019Volume - es-es, Build: 16.0.10379.20043

Error: More than one Excel.exe found.
C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE
C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.EXE

Product: Microsoft Access Runtime 2016 - de-de, 32 Bit, Productversion: AccessRuntimeRetail - de-de, Build: 16.0.10379.20043
Product: Microsoft Office Standard 2019 - de-de, 32 Bit, Productversion: Standard2019Volume - de-de, Build: 16.0.10379.20043

Product: Microsoft Office Professional Plus 2019 - de-de, 32 Bit, Productversion: ProPlus2019Volume - de-de, Build: 16.0.10377.20023
Product: Microsoft Office Professional Plus 2019 - en-us.proof, 32 Bit, Productversion: ProPlus2019Volume - en-us.proof, Build: 16.0.10377.20023
Product: Microsoft Office Profesional Plus 2019 - es-es.proof, 32 Bit, Productversion: ProPlus2019Volume - es-es.proof, Build: 16.0.10377.20023
Product: Microsoft Office Professional Plus 2019 - it-it.proof, 32 Bit, Productversion: ProPlus2019Volume - it-it.proof, Build: 16.0.10377.20023
0

Another way (Office 2019) is you go:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ProPlus2019Volume

office_registry

0

Powershell 5.1 get-package:

get-package *365* | ft -a

Name                                      Version          Source ProviderName
----                                      -------          ------ ------------
Microsoft 365 Apps for enterprise - en-us 16.0.16130.20644        Programs

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .