Win32_ComputerSystem

E

Eric

I've got a program I wrote that tracks our users, takes inventory of
hardware, etc. One function of the program is it uses a VBscript to
poll a machine for inventory using WMI. Works great.

I use the following routine to get the "Number of processors"

Set colSettings = objWMIService.ExecQuery ("Select * from
Win32_ComputerSystem",,48)
For Each objComputer2 in colSettings
intProcessorCount = formatNumber(objComputer.NumberOfProcessors)
Next

Again, nothing wrong with the code, except recently on some new PC's
we've gotten it returns a processor count of 2. (even though it is just
a single processor PC).

I checked the PC's device manager and it lists 2 processors. My
suspicion is that this is "Hyper-Threading" being detected. (since
these are new pcs)

Anyone know how to query WMI to see if HT is on the processor?
(thereby I can just subtract 1 processor if there is HT enabled)
 
J

john smith

Eric said:
I've got a program I wrote that tracks our users, takes inventory of
hardware, etc. One function of the program is it uses a VBscript to
poll a machine for inventory using WMI. Works great.

I use the following routine to get the "Number of processors"

Set colSettings = objWMIService.ExecQuery ("Select * from
Win32_ComputerSystem",,48)
For Each objComputer2 in colSettings
intProcessorCount = formatNumber(objComputer.NumberOfProcessors)
Next

Again, nothing wrong with the code, except recently on some new PC's
we've gotten it returns a processor count of 2. (even though it is just
a single processor PC).

I checked the PC's device manager and it lists 2 processors. My
suspicion is that this is "Hyper-Threading" being detected. (since
these are new pcs)

Anyone know how to query WMI to see if HT is on the processor?
(thereby I can just subtract 1 processor if there is HT enabled)

It could be 3 things:
-a CPU with HyperThreading
-a Dual Core CPU
-two CPUs

WMI has no direct means/features to detect hyperthreading and the like.
Usually people will enumerate CPUs using Winn32_Processor (same issues
though). You can try different things (see if SocketDesignation changes
and such - but that's not overly reliable). Other possibilities are
using the ProcessorId property of the Win32_Processor instance, which
does contain partial CPUID infos (don't recall which registers, in what
order, or called with EAX=?; MSDN should have all the details you
want/need). Some people will make some fancy classes with all kinds of
tests (like, if it returns "GenuineIntel" and that it's a P4 then they
test for HT, etc)
 
E

Eric

Thanks for the post. Wanted to at least confirm my suspicion and
you've given me some ways around it. (I guess my goal was to keep this
inventory program simple, but as I dig deeper it seems I get stuff like
this to account for) /grin

I mainly don't care about the processor count, outside of our servers
which I inventory too, so I guess I'll just ignore the 2 processor
count on the Secretary's PC /grin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top