Tech Me More

To quench our thirst of sharing knowledge about our day to day experience & solution to techincal problems we face in our projects.

Advertise with us !
Send us an email at

Thursday, December 17, 2020

PowerCLI scripts for VMware vCenter

For data centers with considerable virtual machines, changing the configuration for all/most VM's is a tedious task. For which VMware vCenter provides PowerCLI commands which can get be used to automate this flow. 

Changing or Switching the VLAN of Virtual Machines. 

Example:1 To change the VLAN for VMs starting with Centos-nginx- prefix

for (($i = 1500); $i -lt 2000; $i++)
Get-VM "Centos-nginx-$i" | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName "vxw-dvs-100-virtualwire-8-sid-5005-arc-vm05" -Confirm:$false

No comments: