VMware Cloud Community
bowulf
Enthusiast
Enthusiast

New-VirtualPortGroup options

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

0 Kudos
2 Replies
LucD
Leadership
Leadership

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

halr9000
Commander
Commander

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








Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos