?
Solved

VBscript to fetch the number of physical processors (Windows)

Posted on 2007-07-24
5
Medium Priority
?
3,131 Views
Last Modified: 2012-06-27
Can any one help me to get a VBscript to fetch the number of physical processors installed on a windows machine..
0
Comment
Question by:Viswa8888
  • 2
3 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 19559174
would look at the set command since it is probably already stored in the environmental variables.

Type set form a command prompt and filter the results using find or similar from DOS

I hope this helps !
0
 
LVL 63

Accepted Solution

by:
SysExpert earned 1000 total points
ID: 19559182
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 1000 total points
ID: 19560364
Hi, I'm not in a position to test this at the moment, but try this on a machine that has two processsors, as well as two or more cores in one processor, because the results may be different, and you might have to look carefully to distinguish the physical processors.
I have a feeling the ProcessorID might be the one that tells you the difference.
'===================
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
                                       wbemFlagReturnImmediately + wbemFlagForwardOnly)

WScript.Echo "NumberOfProcessors: " & objItem.NumberOfProcessors


Set colItems = Nothing
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
                                       wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
   WScript.Echo "Caption: " & objItem.Caption
   WScript.Echo "DeviceID: " & objItem.DeviceID
   WScript.Echo "Name: " & objItem.Name
   WScript.Echo "ProcessorId: " & objItem.ProcessorId
   WScript.Echo "UniqueId: " & objItem.UniqueId
Next

Set colItems = Nothing
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProcessor", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
   WScript.Echo "GroupComponent: " & objItem.GroupComponent
   WScript.Echo "PartComponent: " & objItem.PartComponent
Next
'===================

Regards,

Rob.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
It is a real story and is one of my scariest tech experiences. Most users think that IT experts like us know how to fix all computer problems. However, if there is a time constraint and you MUST not fail the task or you will lose your job, a simple …
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question