Number of Processors vs. Number of Cores

In this day of multicore, multiprocessor systemboards, licensing becomes a little more complicated.  Some packages are licensed per core, others per processor. Still others are licensed per n cores per processor.  At any rate, Win32_Processor doesn't return the number of processors, only the number of cores.  Each processor does return its $_.SocketDesignation, so the count of unique SocketDesignation property values should correspond to the number of physical processor.

$processorCount = ((Get-WmiObject -ComputerName $myComputer -Query "select * from Win32_Processor") | Group-Object -Property SocketDesignation).Count;

Mind you, on W2K3R2 at least, the actual value of each core's SocketDesignation is next to useless.  A known bug (addressed by a KB) causes WMI to report all the Sockets on the first processor except one, so your quad-core dual-proc board will have 7 cores on one processor and 1 on the other.

Comments (3)

  1. Srikanth says:

    I guess the cmdlet to be used is Get-WmiObject ( gwmi ) and not get-wmi

  2. Srikanth says:

    The cmdlet to be used is Get-WmiObject ( gwmi )

  3. timdunn says:

    Sorry, that was my error.  Thanks for catching it!

Skip to main content