Powershell to Ping Given Rage of IP Address and Get the Status

Below Powershell helps to ping given set of ip address and get the result status and also provides the status of number of machines which are rechable

$ping = New-Object System.Net.NetworkInformation.Ping
$i = 0
1..255 | foreach { $ip = “192.168.1.$_”
$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

Powershell Script to check Health Services running in all Exchange 2007 servers

Below power shell Command Gets Each of the Exchange 2007 Server in the Environment and Check the Health Services then display the status.  Exchange Services varies depend on the type of services installed. Mailbox Services , Hubtransport Servers, Client Access server has some common service and some unique services. Test-Serverhealth performs the health check only on required services depending on the type of server Installed.

$ExchServer=Get-ExchangeServer
foreach ($Server in $ExchServer)
{
echo $Server.name (Test-ServiceHealth $Server)
}