Friday, 15 November 2013

Ping a Series of IP Address using Powershell

How to ping a Series of IP Address using Powershell Script.


I have used series 10.200.200 in code. Please change it as per requirement. 


$ping = New-Object System.Net.NetworkInformation.Ping
$i = 0
1..255 | foreach { $ip = “10.200.200.$_”
$Res = $ping.send($ip)
if ($Res.Status -eq “Success”)
{
$result = $ip + ” = Success”
Write-Host $result
$i++
}}
$Hosts = [string]$i + ” Hosts is pingable”
Write-Host $Hosts

No comments:

Post a Comment

Install Multiple Software with a Click