I have assigned a project to check that VM can ping the default gateway using PowerShell CLI. How do I ping the default gateway of VM?
I guess you need to do that from within the Guest OS of the VM.
If the VM has VMware Tools installed you can use the Invoke-VMScript cmdlet.
If you want to do that from a PowerShell script, you can use the Test-Connection cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
To run en masse against Linux (RHEL or similar, at least), something like 'ping -c 4 `route -n | grep UG | cut -d '' '' -f10`' as a ScriptText would work.