Skip to content

Get- and Set-VMLatencySensitivity PowerShell Function

The Get-VMLatencySensitivity, Get-VMLatencySensitivityBulk and Set-VMLatencySensitivity PowerShell functions configure can return and set the latency sensitivity level of a virtual machine. You can adjust the latency sensitivity of a virtual machine to optimize the scheduling delay for latency sensitive applications.

The function is part of my Virten.net.VimAutomation module, which is a set of PowerShell function built for managing, troubleshooting and automating VMware based platforms. The module can be easily obtained from the PowerShell Gallery and is available on GitHub.

Install Virten.net.VimAutomation from PowerShell Gallery
The Virten.net PowerCLI Automation Module is available in the PowerShell Gallery.
PS> Install-Module -Name Virten.net.VimAutomation

If you've already installed the module, use Update-Module to update it to the latest version.
PS> Update-Module -Name Virten.net.VimAutomation

Install Virten.net.VimAutomation from GitHub (Manual Installation)
The Virten.net PowerCLI Automation Module is also available on GitHub. To manually install this module, copy the Virten.net.VimAutomation folder (Download) into your local module directory. There are various module directories, they can be identified with the $env:PSModulePath environment variable. Activate the module with PS> Import-Module Virten.net.VimAutomation -Force -Verbose.

Get-VMLatencySensitivity

The Get-VMLatencySensitivity function returns the Latency Sensitivity configuration from a Virtual  Machine. The sensitivity level can be also configured to low, normal, medium and high. With the vSpehre Web Client, the configuration can be viewed within VM -> Edit Settings -> VM Options -> Advanced.

For large inventories, consider the Get-VMLatencySensitivityBulk function.

Examples
Get Latency Sensitivity configuration from a Virtual Machine:

PS> Get-VM app01 | Get-VMLatencySensitivity

Name         LatencySensitivity
----         ------------------
app01                    normal

Get all Virtual Machines that are not configured with the default latency sensitivity (normal):

PS> Get-VMLatencySensitivity |? {$_.LatencySensitivity -notmatch "normal"}

Name         LatencySensitivity
----         ------------------
app01                      high
app04                       low

 

Get-VMLatencySensitivityBulk

The Get-VMLatencySensitivityBulk function returns the Latency Sensitivity configuration from all Virtual Machines in the inventory. This function is optimized to be used in large platforms but does not accept pipelines as input.

If you want to query the configuration from single virtual machines, use the Get-VMLatencySensitivity function.

Examples
Latency Sensitivity configuration from a Virtual Machine:

PS> Get-VMLatencySensitivityBulk

Name         LatencySensitivity
----         ------------------
app01                    normal
app02                    normal
app03                       low

Get all Virtual Machines that are not configured with the default latency sensitivity (normal):

PS> Get-VMLatencySensitivityBulk -hideNormal

Name         LatencySensitivity
----         ------------------
app03                       low

 

Set-VMLatencySensitivity

The Set-VMLatencySensitivity function configures the Latency Sensitivity configuration from a Virtual  Machine. The sensitivity level can be also configured to low, normal, medium and high. With the vSpehre Web Client, the configuration can be viewed within VM -> Edit Settings -> VM Options -> Advanced.

Examples
Set the Virtual Machine app02 to latency sensitivity level "high":

PS> Set-VMLatencySensitivity -VM app02 -Level high

Configure all Servers, starting with "app" to latency sensitivity level "high":

PS> Get-VM app* | Set-VMLatencySensitivity -Level high

Get all Virtual Machines that are not configured with the default latency sensitivity (normal) and set them back to "normal":

PS> Get-VMLatencySensitivityBulk -hideNormal |Set-VMLatencySensitivity -Level normal

 

Leave a Reply

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