Q. How can I query processor cores or sockets using PowerShell?

A. To query processor cores or sockets, run

 Get-WmiObject Win32_Processor; add -computername whatever

to query a remote computer (replacing whatever with a comma-separated list of computer names). There is a NumberOfCores property that has what you need. Each instance of Win32_Processor is a socket. This has only been the case since Windows Server 2008 and Windows Vista. Prior to that, you'll see an instance of Win32_Processor for each core, without any information on how many sockets those are spread across. The remarks on the Win32_Processor Class page explain this in more detail.

Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.