Need to report on powered on VMs that are not pingable spanning multiple domains

So have I have this nice script that goes out and checks for vms that have outdated vmware tools, I have one for linux machines and one for windows...both work very nicely.  But one day about 4 out of 1000 weren't pingable the next morning when this scheduled script ran.  This concerned my manager and asked that I either send out a change notice every time this is run or account for the vms that aren't pingable after the vmware tools update.  I went with trying to add a check in the script to see if the vm is pingable after the vmware tools update.

I have found this script below, it works good but only  my domain, we have servers that run on a total of three domains, for example most of my servers run on, domain and from another division some servers dns are in the, and a third division is the  My script only is able to accurately test VMs on my domain, and vms that are in & come up as not responding.  Is there a way to have the script check each domain before it gives a status of not responding?

$folder = read-host "What folder do you want to search for non-pingable VMs"

$location = get-folder $folder | get-resourcepool -name "Servers"

#VM or naming convention to search for

$vms = Get-VM -location $location | where {$_.PowerState -eq "PoweredOn"}

foreach ($vm in $vms) {

    $ping = New-Object System.Net.NetworkInformation.Ping



        $status = [string]($ping.Send($vm)).Status


    catch [System.Net.NetworkInformation.PingException]{$status = $null}


        Success {}

        Default {

            Write-Host "$vm not responding."




original script can be found at Pinging multiple VM’s: PowerCLI — DAMIAN KARLSON

0 Kudos
0 Replies