Link to home
Start Free TrialLog in
Avatar of SweetingA
SweetingA

asked on

Stop Script Box Display During Ping Test

I am using a standard piece of code for a ping test but i would like to do it in the background without displaying the command box - how do i modify the script?

Function SystemOnline(ByVal ComputerName As String)

Dim oShell, oExec As Variant
Dim strText, strCmd As String
 
strText = ""
strCmd = "ping -n 3 -w 1000 " & ComputerName
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
 
Do While Not oExec.StdOut.AtEndOfStream
    strText = oExec.StdOut.ReadLine()
    If InStr(strText, "Reply") > 0 Then
        SystemOnline = True
        Exit Do
    End If
Loop

End Function

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial