VMware Cloud Community
fborges555
Enthusiast
Enthusiast

Change current Vlan to new vlan

HI

I would like to change Vlan on my vms, I have so far the following

$vms=get-content "mytextfile"

foreach($vmguest in $vms)

{$netadapter = get-networkadapter -vm $vmguest

set-networkadapter -networkadapter $netadapter ...... here is where i am stuck

}

any help if I am in the right direction and if not, any help anyways

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

Do you want to change all vNIC on those VMs to the same portgroup?

In that case, you could do

Get-VM -Name (Get-Content -path "mytextfile") |

Get-NetworkAdapter |

Set-NetworkAdapter -NetworkName $newPG


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

Reply
0 Kudos