Tuesday, February 25, 2020

VMware Network Portgroup Connectivity Check with Circular VM vMotion

Now, it's a blogging time. Here is the little script that you can use to check the network connectivity of each portgroup in your vmware environment, which can also be used to determine if the portgroups or physical uplink (backing the vswitch) has the desired vlan access for the multiple exsi hosts.

This script will output the the VM's ICMP Ping status after making vMotion to each host within the current vmware cluster (where the VM resides) or any clusters. I assumed you have already connected to vCenter with the command: Get-VC -Server xxx.xxx.xxx.xxx -Credential (Get-Credential)

Example Usage:
.\Vlan_Portgroup_Check_with_Circular_VM_vMotions.ps1 -VMName "Testing-VM" -IPAddress 10.10.10.10 -ClusterNames "vmware-cluster1"
This will vMotion the "Testing-VM" within all esxi hosts in the cluster named as "vmware-cluster1" and output the Ping result of 10.10.10.10
It will count only one 32 byte ICMP Ping packet as success or failure by default.

.\Vlan_Portgroup_Check_with_Circular_VM_vMotions.ps1 -VMName "Testing-VM" -IPAddress 10.10.10.10 -TimeOut 2
This will vMotion the "Testing-VM" within all esxi hosts in the cluster where this VM exists and output the Ping result of 10.10.10.10
It will count only two 32 byte ICMP Ping packets as success or failure as defined in "TimeOut" value.

The Sample Output