Hi,
I am trying to add network cards to an existing virtual switch, in my case I have vSwitch2 connected to vmnic3 and I want to add vmnic4. If I use the command below it replaces vmnic3 with vmnic4
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic4
I have checked the manual and the description for nic parameter is "Specify new network interface cards for the virtual switch. The old NICs are replaced by the specified ones."
I am using VMware vSphere PowerCLI 4.1 build 264274, please help me with the correct comdlets to ADD and REMOVE network cards from an existing virtual switch.
Thanks in advance.
f10
VCP3, VCP4, HPCP, HP UX CSA
Hi,
if you want to keep the old nic on that vswitch you can use the following syntax:
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic3,vmnic4
Removing vmnic4 again would be your old cmd
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic3
because the existing NICs on that vswitch are replaced like you read in the documentary.
Regards.
Hi,
if you want to keep the old nic on that vswitch you can use the following syntax:
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic3,vmnic4
Removing vmnic4 again would be your old cmd
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic3
because the existing NICs on that vswitch are replaced like you read in the documentary.
Regards.
Thank you for the update.
This solves my problem of adding the network card.
Could you also provide the cmdlets to remove a network card from an existing vSwitch.
Maybe my edit of my above answer was too late:
If you got vmnic3 and vmnic4 on that switch now and you want to remove vmnic4
just do a
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic3
it will replace the old nics (vmnic3 and vmnic4) with the new one (vmnic3).
Little bit strange, but it works
Regards
That solution is correct, but if you want to automate this you could also do something like this
$NicToBeRemoved = "vmnic3" Get-VMHost | Get-VirtualSwitch | where {$_.Nic -contains $NicToBeRemoved} | %{ $newNics = $_.Nic | where {$_ -ne $NicToBeRemoved} $_ | Set-VirtualSwitch -Nic $newNics }
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference