VMware Cloud Community
johndavidd
Enthusiast
Enthusiast

Change PortGroup for Existing VMK Port on dVs

Does anyone know if their is a current command set for this? I looked at set-vmhostnetworkadapter and did not see syntax to do it.

Thanks,

0 Kudos
5 Replies
LucD
Leadership
Leadership

Not sure I get the question, a VMK is a portgroup.

So what do you actually want to do, migrate a regular VMK to a dvSwitch based VMK ?

Or create a new dvSwitch VMK portgroup and migrate the settings from the old to the new VMK ?

Perhaps a screenshot of what you want to do from the vSphere or webclient would help.


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

0 Kudos
johndavidd
Enthusiast
Enthusiast

Here you go.. this is an existing dvs vmk port on a vmhost. I want to be able to change the port group via CLI.

vmk_portchange.JPG

0 Kudos
johndavidd
Enthusiast
Enthusiast

What you can do is remove the port group then re-add it with the new pg name.

$adapters = Get-VMHost | Get-VMHostNetworkAdapter | ? {$_.portgroupname -match "FAB"}


foreach ($adapter in $adapters) {
    Remove-VMHostNetworkAdapter $adapter -Confirm:$false
    if ($adapter.portgroupname -match "Fab-A")
        {New-VMHostNetworkAdapter -VMHost $adapter.vmhost -IP $adapter.IP -SubnetMask $adapter.subnetmask -PortGroup $newnfspga -VirtualSwitch $dvs}
    if ($adapter.portgroupname -match "Fab-B")
        {New-VMHostNetworkAdapter -VMHost $adapter.vmhost -IP $adapter.IP -SubnetMask $adapter.subnetmask -PortGroup $newnfspgb -VirtualSwitch $dvs}
}

0 Kudos
LucD
Leadership
Leadership

Is this again on a Nexus dvSwitch ?

Looks like that functionality is not there on the VMware provided dvSwitches


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

0 Kudos
johndavidd
Enthusiast
Enthusiast

Yes, again we are discussing a Nexus 1000V.

I will use the posted solution as I detailed above for now as I'm guessing that is the only way to do it.

0 Kudos