$ip ="192.168.1.1"
$wq = (‘select statuscode from win32_pingstatus where address="’ + $ip + ‘"’)
$res = gwmi –query "$wq"
if ($res.StatusCode –eq 0) {
write-host "1"
} else {
write-host "0"
}
$res = $null
system.run[команда,<режим>]
ping 8.8.8.8 -n 1 -k 192.168.0.1 | find /c "TTL"