Highlighted
Contributor
Contributor

Powercli for Latency Sensitivity?

Just curious if anyone knows if there is a way to change the latency sensitivity setting on vSphere 5.5 vms through PowerCLI.  I have a HPC cluster and need every VM to have the setting at high.

Tags (1)
9 Replies
Highlighted
User Moderator
User Moderator

No cmdlet for that afaik, but you can try the following

$vm = Get-VM -Name MyVM

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.latencySensitivity = New-Object VMware.Vim.LatencySensitivity
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::high

$vm.ExtensionData.ReconfigVM($spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Contributor
Contributor

LucD,

Do you have anything for reporting on the current Latency Sensitivity setting for all VMs in a vcenter?  We haven't used this setting on too many VMs, but I want to do a check on that for about 4,000 VMs.

Thanks

Fred

0 Kudos
Highlighted
User Moderator
User Moderator

Try something like this

Get-View -ViewType VirtualMachine -Property Name,Config.LatencySensitivity |

Select Name,@{N='Sensitivity Level';E={$_.Config.LatencySensitivity.Level}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Enthusiast
Enthusiast

Bringing up this thread as I am needing to find a way to automate switching this value back to 'normal' for all virtual machines in the environment. I currently have around 548 out of 5300 that have a setting of 'low' somehow. I tried the command above for a single VM (not ideal) but it returned the following error.

Method invocation failed because [VMware.Vim.VirtualMachine] does not contain a method named 'reReconfigVM'.

At line:7 char:1

+ $vm.ExtensionData.reReconfigVM($spec)

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : MethodNotFound

0 Kudos
Highlighted
User Moderator
User Moderator

There is a typo in there, should read ReconfigVM ​(corrected it above).


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Highlighted
Enthusiast
Enthusiast

Thank you for the quick reply. I also wanted to make sure there isn't a way to apply this settings change to all VM's in the inventory regardless of current setting. (assumption is nothing will happen if already set to normal)

0 Kudos
Highlighted
User Moderator
User Moderator

If it is already set to 'normal', nothing will happen.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Highlighted
Enthusiast
Enthusiast

Ok, great. Good to know.. The below code though is only going to make the change on the designated VM, how do I get it to apply across the entire VM inventory?

$vm = Get-VM -Name MyVM

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.latencySensitivity = New-Object VMware.Vim.LatencySensitivity
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::high

$vm.ExtensionData.ReconfigVM($spec)

0 Kudos
Highlighted
User Moderator
User Moderator

Try like this

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$spec.latencySensitivity = New-Object VMware.Vim.LatencySensitivity

$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::high

Get-VM | %{

    $_.ExtensionData.ReconfigVM($spec)

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos