Skip to content

Instantly share code, notes, and snippets.

@nvpnathan
Created October 18, 2016 19:34
Show Gist options
  • Save nvpnathan/5cbe0e304b53e2de6419ed4df756293c to your computer and use it in GitHub Desktop.
Save nvpnathan/5cbe0e304b53e2de6419ed4df756293c to your computer and use it in GitHub Desktop.
############################################
# Configuration Settings #
############################################
$switchName="NSBU-SE-VIO-VDS"
$promiscuous=$true
$forgedTransmits=$true
$macChanges=$true
###################################################
# Shouldn't need to edit anything below this line #
###################################################
$dvSwitch = Get-VDSwitch $switchname
$spec = New-Object VMware.Vim.VMwareDVSConfigSpec
$spec.configVersion = $dvswitch.ExtensionData.Config.ConfigVersion
$spec.DefaultPortConfig = New-Object VMware.Vim.VMwareDVSPortSetting
$spec.DefaultPortConfig.SecurityPolicy = New-Object VMware.Vim.DVSSecurityPolicy
$spec.DefaultPortConfig.SecurityPolicy.AllowPromiscuous = New-Object VMware.Vim.BoolPolicy
$spec.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value = $promiscuous
$spec.DefaultPortConfig.SecurityPolicy.MacChanges = New-Object VMware.Vim.BoolPolicy
$spec.DefaultPortConfig.SecurityPolicy.MacChanges.Value = $macChanges
$spec.DefaultPortConfig.SecurityPolicy.ForgedTransmits = New-Object VMware.Vim.BoolPolicy
$spec.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value = $forgedTransmits
$dvswitch.ExtensionData.ReconfigureDvs_Task($spec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment