Information TechnologyVirtualization

Enabling and Disabling Hyper-Threading via PowerCLI

I found an interesting discussion on the VMware Communities about managing hyper-threading settings via PowerCLI.  The discussion has a couple of useful scripts.  To find out if hyper-threading is enabled use this script:

Get-Host | Select-Object Name,HyperthreadingActive

To disable hyper-threading, use the connect-VIserver to connect directly to the host and use this script:

## host upon which to act
$strMyHostName = “myhost.domain.com”
## get the View object for the HostCpuSchedulerSystem
$viewHostCPUSchedulerSystem = Get-View (Get-View -ViewType HostSystem -Property ConfigManager.CpuScheduler -Filter @{“Name” = $strMyHostName}).ConfigManager.CpuScheduler
## disable hyperthreading
$viewHostCPUSchedulerSystem.DisableHyperThreading()

Note: DisableHyperThreading method is available in vSphere 4.1 and later.