+ Post New Thread
Results 1 to 9 of 9
Windows Thread, Ping Until Reply in Technical; Heres one for you all to have a think about. We have a number of laptops around the school (Mostly ...
  1. #1
    Bezwick's Avatar
    Join Date
    Feb 2008
    Location
    Nottinghamshire
    Posts
    355
    Thank Post
    92
    Thanked 56 Times in 42 Posts
    Rep Power
    25

    Ping Until Reply

    Heres one for you all to have a think about.

    We have a number of laptops around the school (Mostly Dell 100L's & D505's), which we are using as wireless thin clients and they all work pretty well.
    Essentally they automatically logon and have a batch file run as the windows shell. The Batch file pings our router 10 times as away of delaying the startup sequence while the wireless network starts. Then it runs the RDP client.
    This works great most of the time however during particularly busy periods sometimes the rdp client tries to connect before the wireless has started and fails.
    I could just add extra pings, but at quite times it would still have to wait. Anyone no how to get a batch file to ping until it gets a response?

    Cheers

  2. #2

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,348
    Thank Post
    625
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414
    no but using ping -t will do it forever.

    Ben

  3. #3
    theeldergeek
    Guest
    Quote Originally Posted by Bezwick View Post
    Heres one for you all to have a think about.

    We have a number of laptops around the school (Mostly Dell 100L's & D505's), which we are using as wireless thin clients and they all work pretty well.
    Essentally they automatically logon and have a batch file run as the windows shell. The Batch file pings our router 10 times as away of delaying the startup sequence while the wireless network starts. Then it runs the RDP client.
    This works great most of the time however during particularly busy periods sometimes the rdp client tries to connect before the wireless has started and fails.
    I could just add extra pings, but at quite times it would still have to wait. Anyone no how to get a batch file to ping until it gets a response?

    Cheers
    Try this thread...

    How to ping until I receive a response, then execute Remote Desktop? : Remote Desktop, Microsoft Windows XP

  4. Thanks to theeldergeek from:

    Bezwick (19th October 2009)

  5. #4
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,999
    Thank Post
    120
    Thanked 280 Times in 258 Posts
    Rep Power
    106
    Not batch but if you google WMI ping you may find what you want.

  6. Thanks to ChrisH from:

    Bezwick (19th October 2009)

  7. #5

    Join Date
    May 2006
    Posts
    1,315
    Thank Post
    101
    Thanked 25 Times in 18 Posts
    Rep Power
    25
    This is one I made for exactly the same issue we had.

    Code:
    @echo off
    :start
    ping 192.168.1.1
    if %errorlevel% == 1 (
    goto fail
    ) else (
    enter command to run when connected here
    exit
    )
    :fail
    echo Not connected to network, retrying...
    goto start

  8. 2 Thanks to _Bat_:

    Bezwick (19th October 2009), OutToLunch (19th October 2009)

  9. #6
    ricki's Avatar
    Join Date
    Jul 2005
    Location
    uk
    Posts
    1,475
    Thank Post
    20
    Thanked 164 Times in 157 Posts
    Rep Power
    52
    hi

    Have a look at The EXPTA {blog}: Ping Multiple Computers Until They're Up its not exactly what you need but it might give you a idea.

    richard

  10. Thanks to ricki from:

    Bezwick (19th October 2009)

  11. #7
    Bezwick's Avatar
    Join Date
    Feb 2008
    Location
    Nottinghamshire
    Posts
    355
    Thank Post
    92
    Thanked 56 Times in 42 Posts
    Rep Power
    25
    Thanks everyone especially Bat, used that batch files works brilliantly. Major speed increase during login. Power on to login is now down to 26 seconds.
    Cooooooooollll

  12. #8

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,729
    Thank Post
    3,252
    Thanked 1,049 Times in 971 Posts
    Rep Power
    364
    Not sure if people are allowed access to that seeing as its an EE thread but just in case

    Batch Script

    Code:
    @echo off
    rem batch file to ping a Server until
    rem it is available. Then wait 60 seconds
    rem and connect using Terminal Services
    rem syntax is: REMOTE <name_of_server> 
    rem ping host until it responds
    :start
    ping -n 1 %1
    if %errorlevel% == 0 goto remote_desktop 
    
    rem wait for 10 seconds before trying again
    @echo Waiting 10 seconds...
    ping -n 10 127.0.0.1 > nul 
    
    rem loopback to start
    goto start 
    
    rem initiate remote desktop session
    :remote_desktop
    @echo *****************************************************************
    @echo *Server is now available. Waiting 1 minute for services to start*
    @echo *****************************************************************
    
    rem wait 60 seconds after server is available to
    rem allow services to start
    ping -n 60 127.0.0.1 > nul
    mstsc /v:%1
    By the way - if you create a .rdp file for each connection, and call it the same name as the Server (natch) then you could change the last line to:
    mstsc %1.rdp
    and launch straight into the session.

    VB Script Version

    Code:
    Public Sub TestX()
        If Not PingNRemoteDesktop("www.microsoft.com", 2) Then
            MsgBox "Timeout"
        End If
    End Sub
     
    Public Function PingNRemoteDesktop(ByVal myComputerName As String, ByVal nTimeout As Long) As Boolean
        Dim fs, f
        Dim s As String
        Dim nCount As Long
        
        Set objShell = CreateObject("WScript.Shell")
            
        While (1)
            objShell.Run "cmd /c ping -n 1 -w 1000 " & myComputerName & " >C:\pingresult.txt", 0, True
            Set fs = CreateObject("Scripting.FileSystemObject")
            
            Set f = fs.OpenTextFile("c:\pingresult.txt")
            For i = 1 To 5
                s = f.ReadLine()
            Next i
            
            If Left(s, 10) = "Reply from" Then
                Shell "mstsc /v:" & myComputerName
                PingNRemoteDesktop = True
                Exit Function
            End If
            nCount = nCount + 1
            f.Close
            
            If nCount > nTimeout Then
                PingNRemoteDesktop = False
                Exit Function
            End If
        Wend
    End Function
    Have not tested either so you may have to tweak them

  13. Thanks to mac_shinobi from:

    Bezwick (20th October 2009)

  14. #9

    Join Date
    May 2009
    Location
    UK
    Posts
    294
    Thank Post
    64
    Thanked 21 Times in 20 Posts
    Rep Power
    15
    If you scroll down to the bottom of EE threads, you get to the responses. You don't have to subscribe. Most people stop when they see the adverts and "Register to EE ...".

SHARE:
+ Post New Thread

Similar Threads

  1. [CLOSED] Bug/Error: reply. To a PM with iPhone skin
    By FN-GM in forum EduGeek.net Site Problems
    Replies: 1
    Last Post: 14th February 2010, 08:52 PM
  2. Replies: 1
    Last Post: 30th September 2009, 08:48 AM
  3. [MS Office - 2003] Outlook Auto Reply
    By FN-GM in forum Office Software
    Replies: 1
    Last Post: 3rd October 2008, 01:31 PM
  4. Topic Reply Notification
    By witch in forum Comments and Suggestions
    Replies: 0
    Last Post: 27th April 2007, 09:44 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •