Powershell: ping: Difference between revisions

From ICO wiki
Jump to navigationJump to search
(Created page with 'Skript näitab kas pingitav aadress on edukas või mitte $Srvname = Read-Host "SISESTA HOSTI NIMI VÕI IP AADRESS" $ping = new-object System.Net.NetworkInformation.Ping $shell …')
(No difference)

Revision as of 11:10, 31 May 2012

Skript näitab kas pingitav aadress on edukas või mitte

$Srvname = Read-Host "SISESTA HOSTI NIMI VÕI IP AADRESS" $ping = new-object System.Net.NetworkInformation.Ping

$shell = New-Object -ComObject wscript.shell $test = $ping.send($Srvname)

if (!$?) { $shell.popup("KAHJUKS EI LEIDNUD IP AADRESS MIS SINU HOSTILE VASTAB") } elseif ($test.status -eq "LEITUD") { $shell.popup("LEITUD") } Else { $status = $test.status $shell.popup("$status") }

  1. end