I am trying to deploy a new Virtual Portgroup to a number of new servers. Everything is working, but I have a question. How do I set more advanced options like "Notify Switches" option under NIC Teaming tab to "No"? I couldn't find the solution in the get-help section. All I could set was the VLAN option not the more advanced options like the one above or promiscous mode.
Thanks
The VLAN is the only parameter you can set with the cmdlet.
For other options you will have to revert to the SDK.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This is from my book, wrote this script just a week ago:
param ( [string]$VMHostName, [string]$VSwitchName ) # Get managed object of host server which contains virtual switch we want to configure $vmhost = Get-VMHost $VMHostName $hostview = $vmhost | Get-View # NetworkSystem object oversees all network modifications on a server $ns = Get-View -Id $hostview.ConfigManager.NetworkSystem # Copy current spec object to a new one to hold new settings $vsConfig = $hostview.Config.Network.Vswitch | Where-Object { $_.Name -eq $VSwitchName } $vsSpec = $vsConfig.Spec # This line is where we specify what to change $vsSpec.Policy.Security.AllowPromiscuous = $true # Perform the change $ns.UpdateVirtualSwitch( $VSwitchName, $vsSpec )
Save it to a file and run it like so:
modifvswitch.ps1 -vmhostname
-vswitchname
Co-Host, PowerScripting Podcast (http://powerscripting.net)