search
top

Retrieving Hyperthreading CPU Information on Windows 2008 R2 using PowerShell and CoreInfo

Sometimes you just need to get specific information about the processor and the settings on a server and you really don’t want to get into the BIOS and dig around and find it. There are many ways that we can do that but for this post let’s use PowerShell and a SysInternals tool called CoreInfo. This post is due to a customer request on information from a remote physical server.

CoreInfo

CoreInfo is part of the Microsoft SysInternal’s tools and is a free download. Coreinfo is a command-line utility that shows you the mapping between logical processors and the physical processor, NUMA node, and socket on which they reside, as well as the cache’s assigned to each logical processor. It uses the Windows’ GetLogicalProcessorInformation function to obtain this information and prints it to the screen, representing a mapping to a logical processor with an asterisk e.g. ‘*’. Coreinfo is useful for gaining insight into the processor and cache topology of your system.

Once you have downloaded the application open a command prompt and change into the directory where it lives and type coreinfo. The first time it is a run a popup window for the agreement will appear. Once it is run you will bee greeted with lots of information.

coreinfo1

 

Scroll down the page and look for the Hyperthreading information. It should look similar to this.

coreinfo2

 

From CoreInfo’s output Hyperthreading is alive and kicking. Now let’s see what PowerShell has to say.

PowerShell Script

The PowerShell script below can help you identify if hyperthreading is enabled on the server or not and gives you information about the number of logical and physical processors on the server/machine. The powershell script below makes use of Win32_Processor WMI class.

Code:

# Description: Identify the number of physical processors, logical processors and hyperthreading on the server.
# name: hyperactive.ps1

$vComputerName = "."
$vLogicalCPUs = 0
$vPhysicalCPUs = 0
$vCPUCores = 0
$vSocketDesignation = 0
$vIsHyperThreaded = -1

# Get the Processor information from the WMI object
$vProcessors = [object[]]$(get-WMIObject Win32_Processor -ComputerName $vComputerName)

# To account for older machines
if ($vProcessors[0].NumberOfCores -eq $null)

{
$vSocketDesignation = new-object hashtable
$vProcessors |%{$vSocketDesignation[$_.SocketDesignation] = 1}
$vPhysicalCPUs = $vSocketDesignation.count
$vLogicalCPUs = $vProcessors.count
}

# If the necessary hotfixes are installed as mentioned below, then the NumberOfCores and NumberOfLogicalProcessors can be fetched correctly. For Windows Server 2003, KB932370
else
{
$vCores = $vProcessors.count
$vLogicalCPUs = $($vProcessors|measure-object NumberOfLogicalProcessors -sum).Sum
$vPhysicalCPUs = $($vProcessors|measure-object NumberOfCores -sum).Sum
}

"Logical CPUs: {0}; Physical CPUs: {1}; Number of Cores: {2}" -f $vLogicalCPUs,$vPhysicalCPUs,$vCores
if ($vLogicalCPUs -gt $vPhysicalCPUs)
{
"Hyperthreading: Active"
}
else
{
"Hyperthreading: Inactive"
}

Copy the above contents and save the script and run it on your server. The script will output the following information.

coreinfo4

 

From the two examples we see that HyperThreading is enabled on the server.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top