CAE0621
Contributor
Contributor

Add-VDSwitchPhysicalNetworkAdapter to specific LAG port

Jump to solution

We use a LACP LAG group in our environment and I've been trying to use powercli to add vmnic0 to lag-0 on our vds. 

The below adds vmnic0 to an uplink port on the vds no problem, but I don't see a way to specify WHICH uplink you're trying to add to!

$vds = Get-VDSwitch $vdsname
$nic = Get-VMHost $HOSTNAME | Get-VMHostNetworkAdapter -Physical -Name 'vmnic0'
Get-VDSwitch $vds | Add-VDSwitchPhysicalNetworkAdapter -VMHostPhysicalNic $nic -Confirm:$false 
 
I have this guy all ready with the lagports (lag1-0, lag1-1) but I can think of a way to force Add-VDSwitchPhysicalNetworkAdapter to use them instead of the first available Uplink slot.
$lagports = Get-VDPort -VDSwitch $vds -Uplink | where {$_.ProxyHost -like $hostname} | where-object {$_.Name -like "lag*"}
 
Any thoughts welcome, thanks!
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
5 Replies
CAE0621
Contributor
Contributor

As you can see in my screenshot, I edited the variables I needed to but nothing happens aside from this output:

VnicDevice ConsoleVnicDevice
---------- -----------------

I was trying to just have one vmnic move, for testing purposes. When I tried to move both it rolled it back because it disconnected it from vSphere:

Exception calling "UpdateNetworkConfig" with "2" argument(s): "An error occurred while communicating with the remote host. Network configuration change disconnected the host 'engops-esx6.vuhl.root.mrc.local' from vCenter server and has been rolled back."

Any thoughts on that?

0 Kudos
LucD
Leadership
Leadership

That is the normal procedure when you are moving NIC from the portgroup that also hosts the vmk.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
CAE0621
Contributor
Contributor

I read the thread you linked in total and I got it working! Thanks so much for the help, cool to be helped by the legendary LucD!

0 Kudos
CAE0621
Contributor
Contributor

Disregard

0 Kudos