Check if a device is up through IP address

Checking if a machine is up can be a task similar to eating a cake. Only if other teams decide to send you a list of IP address and ask you to check if the IP is pingable. The script below will come hand for this purpose.

$machines = 'IP Addresses'

foreach ($machine in $machines) { 
        if (test-Connection -ComputerName $machine -Count 2 -Quiet ) {  
         
            write-Host "$machine is alive and Pinging " -ForegroundColor Green 
                     
                    } else 
                     
                    { Write-Warning "$machine seems dead not pinging" 
             
                    }     
} 

Published by iamfazul

Author of the site

Leave a comment