The VBScript Network and Systems Administrator's Cafe

Mar 30 2009   4:13PM GMT

Writing a BGINFO like Script: Displaying Processor information with WMI via the Win32_Processor class

Jerry Lees Jerry Lees Profile: Jerry Lees

I recently had to provide the information displayed with BGINFO on a number of systems. Unfortunately, BGInfo only generates a bitmap, so far as I know, so I decided to write a script to generate the information and use this displayed information to send back to the person who requested it.

The function below is a part of the script I mentioned. It retrieves and returns text that represents the Processor information in the system and teh number of processors in the system. (Note: At this time I don’t have a dual core system to test it with, I believe that it will diplay the number of cores in the system. So, 4 dual core processors will be displayed as 8 processors/cores.)

You can view all the scripts in this BGINFO series here.

Here is the code:

Function GetCPUs(strComputer)
Dim colItems, objItem, address
Dim StrQuery
Dim objWMIService
Dim CoresCores = 0



StrQuery = “SELECT * FROM Win32_Processor”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\CIMV2”)
Set colItems = objWMIService.ExecQuery(strQuery,,48)

For Each objItem in colItems
If Replace(,”GHz”,””) = then
GetCPUs =(round(objItem.CurrentClockSpeed/1024,1)) & “GHz” & ” ” & & VbCrLf
GetCPUs = & VbCrLf
end if
Cores = Cores + 1
GetCPUs =  vbTab & Cores & ” Processors/Cores that are: ” & GetCPUs
End Function

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: