Recently we have migrated the switch port from standard to distributed switch.So wrote the script which helps to add the multiple port group to vDS switch.

$InputFile = “C:\Users\as\ANINFO.csv”
$MyVLANFile = Import-CSV $InputFile
ForEach ($VLAN in $MyVLANFile) {
$MyVLANname = $VLAN.VDSNAMING
$MyVLANid = $VLAN.vLAN

New-VDPortgroup -VDSwitch “PLAN1” -Name $MyVLANname -VlanId $MyVLANid
}

Below mention codes which helps to add the PVLAN in the vDS switch using below mention powercli commands.

$datacenter = “HEX”
New-VDSwitch -Name “PLANCLU” -Location $datacenter -version 6.0.0 -NumUplinkPorts 2
$vds = Get-VDSwitch ‘PLANCLU’
Get-VDSwitch $vds | New-VDSwitchPrivateVlan -PrimaryVlanId 1 -SecondaryVlanId 2 -PrivateVlanType Promiscuous
Get-VDSwitch $vds | New-VDSwitchPrivateVlan -PrimaryVlanId 1 -SecondaryVlanId 3 -PrivateVlanType Isolated
New-VDPortgroup -VDSwitch PLANCLU -Name “PLAN-100” -VlanId 100

 

Advertisements