script to find if office version

Hello experts,

I want to pull a report in the form of a csv from users computers that will show what version of MS Office is installed.

I am not sure what to use and I will appreciate if I can have simple script.

Thank u,
SR ZakNetwork Solutions Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SR ZakNetwork Solutions Author Commented:
it did not work actually. Is there a manual way to do this ?
Try to query the system registry entries using command line.

To get the windows version using System registry , use the following command:

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"
This will give an output which can be parsed to get the current windows version/name.

To get the current office version , use:

reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer"
The output of this command gives the office version in number format such as 14, 15, etc.

Parse the output to get the version number and match against the list of existing Microsoft office versions to get the name of the version installed:

Office 97   -  7.0
Office 98   -  8.0
Office 2000 -  9.0
Office XP   - 10.0
Office 2003 - 11.0
Office 2007 - 12.0
Office 2010 - 14.0
Office 2013 - 15.0
Cloud as a Security Delivery Platform for MSSPs

Every Managed Security Service Provider (MSSP) needs a platform to deliver effective and efficient security-as-a-service to their customers. Scale, elasticity and profitability are a few of the many features that a Cloud platform offers. View our on-demand webinar to learn more!

SR ZakNetwork Solutions Author Commented:
My tech will need to query the registry remotely . How will he connect? By not interrupting the user.
Use the information provided in this Microsoft link
David Johnson, CD, MVPOwnerCommented:
add Office 2016      Word.Application.16
the remote registry service must be enabled to query remote machines.
   Gets the Office version from a list of computernames and returns a CSV of the Computername and Office Version (if available)
 get-officeversion c:\test\servers.txt c:\test\officeversions.csv
 get-officeversion -infile c:\test\servers.txt -outfile c:\test\officeversions.csv
   General notes
function Get-OfficeVersion
    [string] $Infile,
    [string] $outfile
#$outfile = 'C:\temp\office.csv'
#$infile = 'c:\temp\servers.txt'
    $office = @()
    $computers = Get-Content $infile
    $count = $computers.count
    foreach($computer in $computers)
     Write-Progress -Activity "Querying Computers" -Status "Computer: $i of $count " `
      -PercentComplete ($i/$count*100)
        $info = @{}
        $version = 0
          $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer) 
          $reg.OpenSubKey('software\Microsoft\Office').GetSubKeyNames() |% {
            if ($_ -match '(\d+)\.') {
              if ([int]$matches[1] -gt $version) {
                $version = $matches[1]
          if ($version) {
            Write-Debug("$computer : found $version")
            switch($version) {
                "7" {$officename = 'Office 97' }
                "8" {$officename = 'Office 98' }
                "9" {$officename = 'Office 2000' }
                "10" {$officename = 'Office XP' }
                "11" {$officename = 'Office 97' }
                "12" {$officename = 'Office 2003' }
                "13" {$officename = 'Office 2007' }
                "14" {$officename = 'Office 2010' }
                "15" {$officename = 'Office 2013' }
                "16" {$officename = 'Office 2016' }
                default {$officename = 'Unknown Version'}
              $officename = 'Not Installed/Not Available'
    $info.Computer = $computer
    $info.Name= $officename
    $info.version =  $version

    $object = new-object -TypeName PSObject -Property $info
    $office += $object
    $office | select computer,version,name | Export-Csv -NoTypeInformation -Path $outfile
  write-output ("Done")

Open in new window

David Johnson, CD, MVPOwnerCommented:
small change to add pipeline input

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SR ZakNetwork Solutions Author Commented:
Hello David,

The list of computers I have should be in text file or CSV? Do I put file in C:\Temp before I run the powershell script.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.