VMware Cloud Community
MrJohnson
Enthusiast
Enthusiast

Moving VM's with 2 vNIC's from a dvSwitch to a vSwitch?

Hello,

I have a task to move VM's that have more than 1 vNIC connected to a dvSwitch to a vSwitch without any downtime.  If the VM has only one vNIC I can do the migration option from the dvSwitch.  Works like a champ.  My problem is most of my VM's have 2 or 3 vNIC's attached.  I've looked for a script that will help me select a VM and migrate it's vNIC's but came up short. PLEASE HELP as I am new to scripting and go easy on me!

Example:

dvSwitch-Test

testVM

     vmnic0

     vmnic1

Migrate to:


vSwitch0

testVM

     vmnic0

     vmnic1

0 Kudos
5 Replies
LucD
Leadership
Leadership

Are these NICs teamed inside the guest OS ?

Or are these 2 separate LAN connections ?

Can the VM run temporarily on 1 NIC ?


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

0 Kudos
MrJohnson
Enthusiast
Enthusiast

They are not team within the OS but they are on different vLAN's.  They can if the vLAN's are available to the single NIC.

Thank you for replaying.

0 Kudos
LucD
Leadership
Leadership

Did you already try with the Set-NetworkAdapter cmdlet.

You should be able to:

  • Add VLAN2 to the 1st portgroup where NIC1 is connected (provided your LAN team allows and configures that)
  • Use Set-NetworkAdapter to move NIC2 from dvPortgroup2 to Portgroup2
  • Remove VLAN2 from portgroup1

And then repeat this for NIC1.

You can/should check connectivity after important changes (i.e. VLAN remaping, portgroup change...).

I would use the Get-VMGuestNetworkInterface for this.


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

0 Kudos
MrJohnson
Enthusiast
Enthusiast

I've been trying to complete this with the script from Gabes web site.  I'm guessing you are the same LucD in his scripts?  I'm stuck on the second part "Move-VM-to-vSwitch". 

I'm very new to scripting so I will give the Set-NetworkAdapter a try.  I have a few 100 VM's that I need to move from one vCenter to another. 

Again thank you for the help.

0 Kudos
LucD
Leadership
Leadership

Let me know how far you get with Gabe's script.

If you're stuck don't hesitate to ask here.

Yes, I'm the same LucD :smileygrin:


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

0 Kudos