VMware Cloud Community
jvm2016
Hot Shot
Hot Shot
Jump to solution

chnaging network name of network adapter_powercli

Hello Luc,

I am trying to change networkname of  the network adapter (network adapter of vcenter)using powercli.

this adapter is currently configured to DPG on cisco1k and i want to change to standard port group in order to fix the requirement of vcenter upgrade as DPG is configured as static port binding.

get-vm "vmname"|Get-NetworkAdapter|Set-NetworkAdapter -NetworkName "Management Network"

i got following error :

pastedImage_0.png

could you suggest anything related to this error.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Does this give the same error?

$pg = Get-VirtualPortGroup -Name "Management Network"

Get-VM "vmname" | Get-NetworkAdapter | Set-NetworkAdapter -Portgroup $pg

 


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

View solution in original post

Reply
0 Kudos
9 Replies
LucD
Leadership
Leadership
Jump to solution

Is there any output from get-vm "vmname"|Get-NetworkAdapter ?


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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

yes it gave network adapter (only one is configured)   just selected name only here.

pastedImage_0.png

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Does this give the same error?

$pg = Get-VirtualPortGroup -Name "Management Network"

Get-VM "vmname" | Get-NetworkAdapter | Set-NetworkAdapter -Portgroup $pg

 


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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

i got following

pastedImage_0.png

However :smileyconfused:

$pg  for some reasons give two values  though i see only one in c# client.

pastedImage_1.png

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You probably have this VSS portgroup defined on multiple ESXi nodes.

Can you display more info from $pg?

$pg | Select Name,Key,VlanId,VMHostId


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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

pastedImage_1.png

and i need to chose host21 i think i need to start with esxi host then to vss and portgroup.

but problem is i cant to this change from client also.not from directly login to esxi host from client.

one problem i can think is that currently this is configured on DPG of cisco1k and i think we need to shutdown vmto do this .

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Not sure you need to power off the VM for this.

The Web Client has a procedure to move a VM from a VDS portgroup to a VSS portgroup.

I'll have to check if that can be done through code


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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

i did following but got following.

pastedImage_0.png

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

i got the issue actually  there was no  vm standrad port group created on vss.by mistake i was trying to change to vmkernlport .

sorry for trouble.

Reply
0 Kudos