title: Get Total Number of Cores from a computer WITHOUT HyperThreading
body: <p>This is a tough one.</p>
  
  <p>I need to use a command to output the exact number of cores from my servers.</p>
  
  <p>My tests: </p>
  
  <ul>
  <li><strong><code>X</code>:</strong> On a Windows server with 4 processors (sockets) and 2 cores each without HT.</li>
  <li><strong><code>Y</code>:</strong> On a Windows Server with 2 processors (sockets) and 6 cores each with HT.</li>
  </ul>
  
  <p><strong><a href="https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsysteminfo" rel="noreferrer">GetSystemInfo</a></strong> only gets me the number of processors installed: 4 for X, 2 for Y.</p>
  
  <pre><code>|                | X: 8 cores  | Y: 12 cores |
  |                | 4x2 (no HT) | 2x6 (HT)    |
  |----------------|-------------|-------------|
  | Desired output | 8           | 12          |
  | GetSystemInfo  | 4           | 2           | 
  </code></pre>
  
  <p><code>%NUMBER_OF_PROCESSORS%</code> is a good one, but it takes HT into account. It tells me 8 for X and 24 for Y (since it has HT, I needed it to show 12 instead).</p>
  
  <pre><code>|                        | X: 8 cores  | Y: 12 cores |
  |                        | 4x2 (no HT) | 2x6 (HT)    |
  |------------------------|-------------|-------------|
  | Desired output         | 8           | 12          |
  | GetSystemInfo          | 4           | 2           | 
  | %NUMBER_OF_PROCESSORS% | 8           | 24          |
  </code></pre>
  
  <p><code>"wmic cpu get NumberOfCores"</code> gets me info for each socket. For example:</p>
  
  <p><strong>X:</strong></p>
  
  <pre><code>&gt;wmic cpu get NumberOfCores
  NumberOfCores
  2
  2
  2
  2
  </code></pre>
  
  <p><strong>Y:</strong></p>
  
  <pre><code>&gt;wmic cpu get NumberOfCores
  NumberOfCores
  6
  6
  </code></pre>
  
  <p>Meaning</p>
  
  <pre><code>|                            | X: 8 cores  | Y: 12 cores |
  |                            | 4x2 (no HT) | 2x6 (HT)    |
  |----------------------------|-------------|-------------|
  | Desired output             | 8           | 12          |
  | GetSystemInfo              | 4           | 2           | 
  | %NUMBER_OF_PROCESSORS%     | 8           | 24          |
  | wmic cpu get NumberOfCores | 2,2,2,2     | 6,6         |
  </code></pre>
  
  <p>Sigh.</p>
  
  <p>I wished to keep it simple, inside the CMD, but I'm thinking about starting a Powershell script to do all that math and stuff.</p>
  
  <p>Any thoughts?</p>