VMware Cloud Community
OsburnM
Hot Shot
Hot Shot
Jump to solution

PowerCLI Change Host's vMotion VMK IP & PortGroup on a vDS

Greetings all...

I have a bunch of hosts where I need to change the IP (not netmask, gw, etc..) and the VM PortGroup of my vMotion vmk interfaces.

I have a list of servernames, new IPs, and the vm portgroup.  I'm assuming powercli can do it but don't know where to start as all my hosts are now on a vDS.

Any suggestions?

Thanks!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Which PowerCLI version are you using ? Do a

Get-PowerCLIVersion

The latest version at the moment is 5.1 R2


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

View solution in original post

0 Kudos
9 Replies
LucD
Leadership
Leadership
Jump to solution

I'm not sure I understand what you mean by "...VM PortGroup of my vMotion vmk interfaces" ?


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

0 Kudos
OsburnM
Hot Shot
Hot Shot
Jump to solution

Sorry-- I didn't exactly word that very well.

Host > Configuration > Networking > vDS > Manage Virtual Adapters > vmk1 (my vMotion VMK interface) > Edit > Port Group & IP Settings.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The Set-VMHostNetworkAdapter supports vDS portgroups.

Did you try that already ?


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

OsburnM
Hot Shot
Hot Shot
Jump to solution

I'm able to set the IP with something like

Get-VMHost $vmhost | Get-VMHostNetworkAdapter -name $vMotvmk| Set-VMHostNetworkAdapter -IP $vMotIP

But I can't figture out how to change the portgroup of vmkx from "old-vmotion-portgroup" to "new-vmotion-portgroup".

Any ideas there?  I tried the -PortGroup switch in Set-VMHostNetworkAdapter but it doesn't work.  Looks like that's only for migrating from vSwitch to vDS.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The IP and Portgroup parameters belong to different parametersets, you can't use those 2 together.

Did you try using the Set-VMHostNetworkAdapter with the Portgroup parameter in a seperate line ?


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

0 Kudos
OsburnM
Hot Shot
Hot Shot
Jump to solution

Yeah, here's what I'm trying to run...

Get-VMHost $vmhost | Get-VMHostNetworkAdapter -name $vMotvmk | Set-VMHostNetworkAdapter -PortGroup $vmpg
Get-VMHost $vmhost | Get-VMHostNetworkAdapter -name $vMotvmk | Set-VMHostNetworkAdapter -IP $vMotIP

Second line works but the first says the -PortGroup parameter can't be found.  Strange though, doing a get-help set-vmhostnetworkadapter doesn't show -PortGroup; yet, in the online reference, it shows it's there.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Which PowerCLI version are you using ? Do a

Get-PowerCLIVersion

The latest version at the moment is 5.1 R2


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

0 Kudos
OsburnM
Hot Shot
Hot Shot
Jump to solution

VMware vSphere PowerCLI 5.1 Release 1 build 793510

I'll grab R2 and see if that works.

0 Kudos
OsburnM
Hot Shot
Hot Shot
Jump to solution

Bingo--  R2 worked.  Man, I didn't even know it was released!  LOL  I thought R1 was still really new.  Smiley Happy

So for the record -


#Change the host's vmk interface portgroup on a vDS  -->  Get-VMHost $vmhost | Get-VMHostNetworkAdapter -name $vMotvmk | Set-VMHostNetworkAdapter -PortGroup $vmpg
#Change the host's vmk interface IP on a vDS  -->  Get-VMHost $vmhost | Get-VMHostNetworkAdapter -name $vMotvmk | Set-VMHostNetworkAdapter -IP $vMotIP

0 Kudos