HEELPBOOK - Visual Basic 6 - Silent Ping Function ############################################## ########### SCENARIO Can any one supply me with some VB6 code to perform a silent PING. By silent I mean, no DOS screens to appear and the PING is performed in the background without the user being aware. The code also needs to capture the output and I do not require any thing fancy, just some simple code to PING from one PC to another, on a network. Function PingSilent(strComputer) Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & strComputer & "'") For Each objStatus in objPing If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then 'WScript.Echo("Computer " & machine & " is not reachable") PingSilent = 0 Else 'WScript.Echo("Computer " & machine & " is Live") PingSilent = 1 End If Next End Function ########### USAGE You will have to call this function in the following way: PingSilent("172.16.0.25") Usually you can use it in an IF clause: If PingSilent("172.16.0.25") = 0 Then Else End If ############ ARTICLE INFO ############# Article Month: July Article Date: 11/07/2012 Permalink: http://heelpbook.altervista.org/2012/visual-basic-6-silent-ping-function/ Source: http://www.andreavb.com/forum/viewtopic_2780.html Language: English View more articles on: http://www.heelpbook.net/ Follow us on Facebook: http://it-it.facebook.com/pages/HeelpBook/100790870008832 Follow us on Twitter: https://twitter.com/#!/HeelpBook Follow us on RSS Feed: http://feeds.feedburner.com/Heelpbook Follow us on Delicious: http://delicious.com/heelpbook