Modifying vSwitch Offload Policy with Powershell

Of all the vSwitch properties, the Offload Policy settings are the most obscure. You can’t even view them through the GUI. You can see them in the /etc/vmware/esx.conf file, or using the Powershell VI Toolkit, if you know how to use this command:

((Get-VMHostNetwork ESXSERVER | Get-View).NetworkConfig.vSwitch | Where {$_.Name -eq “vSwitch1″}).Spec.Policy.OffloadPolicy

I told you it’s obscure…

Changing the settings is even more difficult, as the method that allows you to do so, requires almost every possible property to be set, even if you don’t want to change it. So, I thought I’d make it a bit more simple. How about the following command:

Set-MyOffloadPolicy -VMHost ESXSERVER -vSwitch “vSwitch1″ -TcpSegmentation Off

All you need is to connect to your VIServer and make sure this function is loaded:

Set-MyOffloadPolicy (rename to .ps1 or copy into your profile)

Hope you like it!