VMware Cloud Community
admin
Immortal
Immortal
Jump to solution

Migrating VMkernel virtual adapters from VDS1 to VDS2

What is the best way to add VMkernel virtual adapters when migrating a host using VDS from vCenter1 to vCenter2? I've attached a sample script I'm using for the process. The last Add-VDSwitchPhysicalNetworkAdapter command fails with a "Value cannot be null" error.

For background, I have a source vCenter Server (version 5.0) and a target vCenter Server (version 5.5). I would like to do a hot migration of a host that uses VDS from vCenter1 to vCenter2. If I run the script step by step, everything works as expected until the Add-VDSwitchPhysicalNetworkAdapter command. I can then complete the process manually using the following process in the vSphere Client:

Hosts and Clusters -> Select host -> Configuration -> Networking -> vSphere Distributed Switch -> Manage Virtual Adapters (for the appropriate VDS) -> Add -> Migrate existing virtual adapters

After completing the manual steps above, I can then remap the VMs and then remove the old VDS (which no longer exists).

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Something like this

$vdpgNames = 'Management Network', 'Storage Network', 'vMotion Network'

$vdpg = Get-VDPortgroup -Name $vdpgNames -VDSwitch $TargetVDS

Add-VDSwitchPhysicalNetworkAdapter -DistributedSwitch $TargetVDS -VMHostPhysicalNic $vmhostNetworkAdapter -VirtualNicPortgroup $vdpg -VMHostVirtualNic $vmk0, $vmk1, $vmk2 -Confirm:$false


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

On the VirtualNicPortgroup parameter, did you already try passing VDPortgroup objects instead of the names ?


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

0 Kudos
admin
Immortal
Immortal
Jump to solution

No, I haven't done that. Can you please show me what that would look like?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Something like this

$vdpgNames = 'Management Network', 'Storage Network', 'vMotion Network'

$vdpg = Get-VDPortgroup -Name $vdpgNames -VDSwitch $TargetVDS

Add-VDSwitchPhysicalNetworkAdapter -DistributedSwitch $TargetVDS -VMHostPhysicalNic $vmhostNetworkAdapter -VirtualNicPortgroup $vdpg -VMHostVirtualNic $vmk0, $vmk1, $vmk2 -Confirm:$false


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

0 Kudos
admin
Immortal
Immortal
Jump to solution

That did it. Thanks for your help!

0 Kudos