Bezwick Posted October 19, 2009 Posted October 19, 2009 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
Guest theeldergeek Posted October 19, 2009 Posted October 19, 2009 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
ChrisH Posted October 19, 2009 Posted October 19, 2009 Not batch but if you google WMI ping you may find what you want. 1
_Bat_ Posted October 19, 2009 Posted October 19, 2009 This is one I made for exactly the same issue we had. @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 2
ricki Posted October 19, 2009 Posted October 19, 2009 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 1
Bezwick Posted October 19, 2009 Author Posted October 19, 2009 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
mac_shinobi Posted October 19, 2009 Posted October 19, 2009 Try this thread... How to ping until I receive a response, then execute Remote Desktop? : Remote Desktop, Microsoft Windows XP Not sure if people are allowed access to that seeing as its an EE thread but just in case Batch Script @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 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 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 1
Ignatius Posted October 19, 2009 Posted October 19, 2009 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 ...".
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now