[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Applet to Prevent VPN Timeouts

Posted on 2008-06-20
4
Medium Priority
?
971 Views
Last Modified: 2012-08-13
I have a couple clients with whom I have VPN accounts where the VPN servers are configured with short timeout periods.  (5 minutes, I believe.)  If I'm using VPN, and I hop over to a local application even for a brief period of time, I get a timeout.  To reestablish my work on the client server, I typically have to logon via VPN and then logon via RD as well.  It's a pain.  Is there a little applet out there (or even a BAT script, VBS script, or a VB.NET piece of code) that would maintain a minimal level of activity through the VPN tunnel that would prevent these timeouts?
0
Comment
Question by:jdana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21830492
It would be very easy to write a script to ping the server at intervals (this is usually enough to keep a connection alive).  Or you could just:

ping (server) -l 1 -t

where (server) is the IP address of a server the other side of the VPN.  The above from a command prompt, and it just pings with one byte of data (the l parameter can be adjusted if this is not enough).

BUT... you say it times out, are you actively disconnected, or does the VPN simply stop working?  If you exceed the Windows idle time, the server will disconnect the VPN.  If the connection just goes dead (but looks like it is connected), then there is likely to be another issue.
0
 

Author Comment

by:jdana
ID: 21830921
purplepomegranite (nice name),

It is a timeout (as opposed to VPN stopping).  

ping (server) -l 1 -t seems pretty good.  Any idea how to call it from a vbs script?  (I'd like to drop it in a loop to slow it down a bit.)
0
 
LVL 24

Accepted Solution

by:
purplepomegranite earned 1000 total points
ID: 21834946
The attached code will ping until the first unsuccessful ping (or you stop the script with <CTRL><C>).  Just change the parts I've commented.  It outputs the result to the command window.
Option Explicit
dim blnPinged, strHost
strHost="www.google.com"  ' Change the address to where you want to ping
blnPinged=true
 
while blnPinged ' Loop while ping is successful
	blnPinged=Ping(strHost)
	if blnPinged then
		wscript.echo "Pinged " & strHost & " successfully at " & Now
		WScript.Sleep 1000 ' 1000 is one second, adjust accordingly
	else
		wscript.echo "Ping failed to " & strHost & " at " & Now
	end if
wend
 
 
Function Ping(strHost)
	dim objPing, objRetStatus
	set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
	("select * from Win32_PingStatus where address = '" & strHost & "'")
 
	for each objRetStatus in objPing
		if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
			Ping = False
		else
			Ping = True
		end if
	next
End Function

Open in new window

0
 

Author Closing Comment

by:jdana
ID: 31597260
Awesome!  Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question