' Name: office_versions.vbs ' Version: 1.0 ' Written By: Jim Cameron [Based on code at references ' listed below] ' Written: November 28, 2006 ' Last Modified: November 28, 2006 ' Description: This script displays the version of Microsoft Office products ' on the specified system or systems. If no system is specified as an argument ' to the script, it will provide the information for the system on which ' it is being run. Or, instead, one or more systems can be specified as ' arguments on the command line, separated by spaces. ' Usage: "cscript /nologo office_versions.vbs" to check the current system ' or "cscript /nologo office_versions.vbs sysa sysb sysc" to check 3 systems ' named sysa, sysb, and sysc. ' Limitations: This script is designed only to query systems running Windows XP. ' See http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan05/hey0110.mspx ' for further information on the limitations ' References: ' ' 1. Hey, Scripting Guy! How Can I Determine Which Version of Word is Installed ' on a computer. ' http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan05/hey0110.mspx ' ' 2. Hey, Scripting Guy! How Can I Use Both Command-line Arguments and a ' Default Value? ' http://thesource.ofallevil.com/technet/scriptcenter/resources/qanda/sept04/hey0915.mspx If Wscript.Arguments.Count = 0 Then arrComputers = Array(".") Else Dim arrComputers() For i = 0 to Wscript.Arguments.Count - 1 Redim Preserve arrComputers(i) arrComputers(i) = Wscript.Arguments(i) Next End If For Each strComputer in arrComputers Set objWMIService = GetObject _ ("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objItem in colItems Wscript.Echo ("System: " + strComputer + " OS: " + objItem.Caption) Wscript.Echo "" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colApps = objWMIService.ExecQuery _ ("Select * from Win32_Product Where Caption Like '%Microsoft Office%'") For Each objApp in colApps Wscript.Echo objApp.Caption, objApp.Version Next Next Wscript.Echo "" Next