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