VMware Cloud Community
crnielsen
Contributor
Contributor

Migrate ESX host management to DVS with PowerCLI

Hi

I am trying to migrate a newly installed ESX host from a standard switch to a Distributed switch with PowerCLI. I have done some testing with the VDSPowerCLI and LucD's tools. I have a general idea on what to do:

  1. Get the VDS
  2. Attach it to the host
  3. Find the vmk interface (Management IP)
  4. Find the physical links

Now as step 5 the problem appear. I only have one physical nic available at this time, so i need to migrate both the vmk port and the physical nic from the standard switch to the distributed switch with one single command, otherwise i loose connectivity to the ESX. It is possible to do this from the vSphere Client, so it should be possible to do it via SDK/PowerCLI as well.

I hope there is someone out there that have some hints for me.

Regards

Claus

0 Kudos
3 Replies
LucD
Leadership
Leadership

Did you already try with the AddServiceConsoleVirtualNic method ?

I use it in my dvSwitch scripting – Part 3 – Service Console & vmKernel post.

Did you already check if Onyx shows what the GUI is actually doing ?


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

crnielsen
Contributor
Contributor

Hi

Onyx gave med the answer.

It created a single VMware.Vim.HostNetworkConfig object, that both removed the pnic and vmk from the standard switch, and then added them to the distributed switch. Then a single call of UpdateNetworkConfig did the change. 🙂

Thanks for the hint, LucD

0 Kudos
johndavidd
Enthusiast
Enthusiast

Can you share your code here?

0 Kudos