Ping Sweep test using PowerCLI and vCenter

I had a reason to do a ping sweep across a set of machines with vCenter using PowerCLI.  The Test-Connection cmdlet is available on Win 8 / Win 2012 R2.   Enjoy.

# Assuming you’ve loaded the PowerCLI snapin located @
# Loading PowerCLI Snapins
function LoadSnapin{
if (!(Get-PSSnapin | where {$_.Name   -eq $PSSnapinName})){
Add-pssnapin -name $PSSnapinName
LoadSnapin -PSSnapinName   “VMware.VimAutomation.Core”

#An account is needed
$cred = Get-Credential “domainuser”

#Connect to vCenter
Connect-VIServer -server “vCenterServer” -credential $cred
$a = Get-Cluster “Server-Cluster-Name” | get-vm
$results = @()
foreach($computer in $a)
Write-Host $Computer.Name
$results += Test-Connection -ComputerName $Computer.Name -count 2

$results | Select Address,IPV4Address,ReplySize,ResponseTime | Export-Csv results.csv
Here is a sample output

#TYPE Selected.System.Management.ManagementObject