by sleightofhand at 2013-01-03 11:12:15
Im looking for a Powershell / WMI command to get the number of cores on a Windows 2003 server. My findings show the Get-WmiObject win32_processor numberofcores work with Win2k8 but NOT 2003 server o/s.
by powerschill at 2013-01-03 11:27:46
I tested it out on my 2008 R2 test servers and the values were returned. Try the following commands and see if any of them return values.
Get-WMIObject -ComputerName $ComputerName -Class Win32_ComputerSystem -ErrorAction SilentlyContinue | Select-Object -ExpandProperty NumberOfProcessors
Get-WMIObject -ComputerName $ComputerName -Class Win32_Processor -ErrorAction SilentlyContinue | Select-Object -ExpandProperty NumberOfcores
Get-WMIObject -ComputerName $ComputerName -Class Win32_Processor -ErrorAction SilentlyContinue | Select-Object -ExpandProperty NumberOfLogicalProcessors
by sleightofhand at 2013-01-03 11:44:49
Thanks powerschill – The problem are the results from 2003 (I corrected my post) – Try comparing WMI results with what you get from msinfo32.exe on windows 2003 server.
by sleightofhand at 2013-01-03 12:05:30
OK.. noob user error on my part... powerschill is correct...! Thanks! I updated my Post to note Windows 2003 server (not 2008 server).
by RichardSiddaway at 2013-01-04 06:06:46
You've stumbled over one of the annoying features of WMI in that it is updated as new versions of Windows are released but the updates aren't made available for downlevel OS's In this case Windows Vista/Windows 2008 and later report the number of processors and cores correctly. All earlier versions report the number of cores as the number of processors
by sleightofhand at 2013-01-04 11:43:26
Does anyone recommend a consistent workaround for those o/s' prior to server 2008? Preferably using or embedding into PowerShell scripting?
by RichardSiddaway at 2013-01-05 04:21:44
Not sure – I don't have anything lower than Win 2008 available at the moment. This is an awkward on because Windows isn't consistent for example
On my Windows 8 machine that has a single dual core processor.
Check out this MS support article http://support.microsoft.com/kb/932370 for a hotfix that corrects the behaviour of Win32_Processor and Win32_ComputerSystem
by sleightofhand at 2013-01-08 12:39:42
Thanks.... we can close out this question as it appears a Microsoft issue – not really here in this Powershell / WMI forum. If I find a solution – I will share. Thanks again to all who posted!