VMware Cloud Community
charleswelton
Enthusiast
Enthusiast
Jump to solution

Add-VDSwitchVMHost Issue

Hello:

I am automating (via PowerCLI) the migration of VM hosts from a cluster running 5.5 to a cluster running 6.0.  I have most of the steps completed, except I am getting stuck when running the "Add-VDSwitchVMHost" command.  I get the following error:

2016-01-29_163942.png

I have verified that this host is not already added to VDSwitch.  Is there something that I am missing?  Here are the steps that are performed in my script prior to attempting to add host to destination VDSwitch:

# 1: Connect to source VI server (result: success)

# 2: Collect VLAN information from source VI server using the "Get-NetworkAdapter" command (result: success)

# 3: Place host in "Disconnected" state on source VI server (result: success)

# 4: Disconnect from source VI server (result: success)

# 5: Connect to destination VI server (result: success)

# 6: Add host to destination VI server (result: success)

# 7: Add host to VDSwitch using this exact syntax (result: failed)

-- Add-VDSwitchVMHost -VDSwitch sshvc01vds -VMHost stl-besxhstp11.smrcy.com

I am stuck at this point.  The plan is to add VMs to their respective networks once I successfully added the host to destination VI server.  I have been looking online, but I can't find anyone that has ran into my specific issue.  Any guidance would be greatly appreciated!  Thank you.

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

I suspect the Web Client is doing the Remove-VDSwitchVMHost for you behind the covers.

We could confirm that by running the Web Client action through the Web Client Onyx, that would show the methods being called.

But does it work when you do the Remove-VDSwitchVMHost before your remove the ESXi node from the cluster ?


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

View solution in original post

Reply
0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

Host membership of a vdSwitch is also kept in a file on one of the datastores.

That file is checked when you add the host to the switch.

I derive that the switchname is the same in the old and the new environment ?

You have two options (I think)

1. Remove the host from the dvSwitch before moving it to the other environment

2. Use different names for the dvSwitches


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

Reply
0 Kudos
charleswelton
Enthusiast
Enthusiast
Jump to solution

Thank you, you assume correctly.  The switch name is the same in both the old and new environments.  I will attempt both options you provided and see how it goes.

Thanks again for the fast response!

Reply
0 Kudos
charleswelton
Enthusiast
Enthusiast
Jump to solution

Why is it that I am able to perform the adding of the host to the new VDSwitch, which as the same name as the old VDSwitch, through the web client, but can't using PowerCLI?  Is there a parameter or argument that I am missing from my command?  Maybe I'm not even using the correct command?

Thanks...

Charles

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I suspect the Web Client is doing the Remove-VDSwitchVMHost for you behind the covers.

We could confirm that by running the Web Client action through the Web Client Onyx, that would show the methods being called.

But does it work when you do the Remove-VDSwitchVMHost before your remove the ESXi node from the cluster ?


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

Reply
0 Kudos
charleswelton
Enthusiast
Enthusiast
Jump to solution

Thanks, LucD...

We used Onyx taking the generated code and put it into a Powershell function.  Worked like a charm!

Reply
0 Kudos