Chapter 2: Configuring WMI 41
Office_ExcelVersion.vbs
strComputer = "." .
wmiNS = "\root\cimv2" .
wmiQuery = "Select * from Office_ExcelVersion" .
Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS) .
Set colItems = objWMIService.ExecQuery(wmiQuery) .
For Each objItem in colItems .
wscript.echo
"Build: " & objItem.Build .
wscript.echo "Name: " & objItem.Name .
wscript.echo "Path: " & objItem.Path .
wscript.echo "Version: " & objItem.Version .
wscript.echo " ".
next.
Once the information is collected, it is returned to the requesting application or script. Run-
ning a script on the local computer is really exciting—but, for extreme excitement, you need to
talk to multiple machines. Network administrators rarely work with single comput