Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

quick command or batch script to determine Windows and Office version

I need to do a software audit of more than 300 computers that are neither on the same network, or owned by the same company.

Is there an command or small program (that can be run without installing) that I can email to the end-users to run that will output the MS Windows and MS Office versions?

like image 566
Reece Avatar asked Sep 16 '13 04:09

Reece


2 Answers

One possible way of obtaining the current Windows Version and Microsoft Office version is 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
Office 2016 - 16.0

Hope this helps!!

like image 79
r3ap3r Avatar answered Oct 07 '22 10:10

r3ap3r


@echo off
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
echo %office_version%
endlocal

does NOT require administrator permissions and works on Windows XP and above

like image 41
npocmaka Avatar answered Oct 07 '22 10:10

npocmaka