Pinging to machine

  • פותח הנושא tul1
  • פורסם בתאריך

tul1

New member
Pinging to machine

Hi, Any vbs command or script that allow me to check if machine is pingable on the network? Thanks in advance, Tal
 

antidot

New member
------>

'******************************************************************** '* Function IsPingable(strHost) '* '* Returns True or False based on the output from ping.exe '******************************************************************** Function IsPingable(strHost) Set objShell = WScript.CreateObject("WScript.Shell") Set objExecObject = objShell.Exec("cmd /c ping.exe -n 3 -w 1000 " & strHost) Do While Not objExecObject.StdOut.AtEndOfStream strText = objExecObject.StdOut.ReadLine() If Instr(strText, "Reply") > 0 Then 'Wscript.Echo "Reply received." IsPingable = True Exit Do End If Loop If (IsPingable <> True) Then IsPingable = False End If End Function​
אם הקוד משתבש, אז מדובר בפונקציה אחרונה מכאן: http://petri.co.il/forums/archive/o_t__t_367__vbs-check-for-file-existence-on-a-set-of-remote-comuters..html
 
למעלה