Powershell: Virtual Machine Manager – Disable Virtual Adaptor Network Optimisation

If you use Virtual Machine Manager then you may have issues live-migrating VMs between hosts.

You may get messages like this in the VMM job list:

Information (11037)

There currently are no network adapters with network optimization available on host ACME.contoso.local

Error (10434)

No suitable host is available for migrating the existing highly available virtual machines.

Recommended Action

Either improve the host ratings for the other hosts within the same cluster, and then try the operation again, or do not migrate the virtual machines.

Usually this is down to different virtual switches having optimisation enabled or disabled (in my environment the hosts with Broadcom chipsets don’t support it and so it’s disabled but the Intel ones do).
In VMM 2016 and, I believe, VMM 2012 R2 changing this setting for the switch itself wasn’t that easy (all the guides online refer to a GUI option that no longer exists). In any case I really didn’t want to change the switch settings.

After Googling I found some Powershell by Richard Skinner over at richardstk.com which allowed me to easily disable the optimisation for a VM. All I’ve done below is add a simple loop so that you can hit all your VMs:

import-module virtualmachinemanager

$VMlist = (Get-SCVirtualMachine | Get-SCVirtualNetworkAdapter | where -property VMNetworkOptimizationEnabled -EQ $true) 

foreach ($V in $VMlist) {

Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $V -EnableVMNetworkOptimization $false

}

Leave a Reply

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