Reputation: 13
I am trying to get the number of cores for multiple windows computers/servers across our Domain. There is Windows 2008R2, Windows 2012, Windows 2016, and Windows 10. When I open a CMD and type
wmic /NODE:"Hostname" /USER:"Domain\AdminAcoount" OS GET numberofcores
I get
Node - Hostname
ERROR:
Description = Invalid query
Any ideas what I am doing wrong? Thanks!
Upvotes: 1
Views: 6960
Reputation: 16236
The number of cores is part of the CPU, not the OS.
C:\>wmic /NODE:localhost cpu get NumberOfCores, NumberOfLogicalProcessors
NumberOfCores NumberOfLogicalProcessors
4 8
When you are ready to step up to PowerShell.
PS C:\> Get-WmiObject Win32_Processor | Select-Object -Property NumberOfCores
NumberOfCores
-------------
4
Or, from withing a cmd .bat script.
C:\>powershell -NoProfile -Command "& { Get-WmiObject Win32_Processor | Select-Object -Property NumberOfCores }"
NumberOfCores
-------------
4
Upvotes: 1