Detect DUN connection using VBScript 
Author Message
 Detect DUN connection using VBScript

I thought of using a check for IP address approach, but I'm hoping
there's something more elegant.

Thanks.



Sat, 07 Aug 2004 08:48:09 GMT  
 Detect DUN connection using VBScript

Quote:

> I thought of using a check for IP address approach, but I'm hoping
> there's something more elegant.

RASDIAL.EXE with no arguments gives the current connection in a string, or "No
connections", so you can check on this output.

Bill Stewart has a free utility:
http://www.oregonclassifieds.net/utilities/files/tools2.zip

Example code:
Set oShell = CreateObject("Wscript.Shell")

If oShell.Run("rasconns.exe", 0, True) > 0 Then
  MsgBox "Connected by RAS"
End If

For Win98/WinMe:
RASStatus method in the free WSHRas OCX at Born's WSH-Bazaar Look under ActiveX
Controls):

http://www.borncity.de/WSHBazaar/WSHBazaar.htm

From a previous thread:

<qoute>

Subject: Re: Dial Up Connection
Newsgroups: microsoft.public.scripting.wsh
Date: 2000-10-24 02:24:28 PST

This would work on a Win9x or WinMe system, but probably not for NT or Win2K
(not tested for those):

Set ws = WScript.CreateObject("WScript.Shell")
RegKey = "HKLM\System\CurrentControlSet\Services" &
         "\RemoteAccess\Remote Connection"
If ws.RegRead(RegKey)(0) = 1 Then
  MsgBox "Already Connected"
Else
  MsgBox "Not Connected"
End If

--
Bill James
Microsoft MVP?DTS

</qoute>

--
torgeir



Sat, 07 Aug 2004 09:03:21 GMT  
 Detect DUN connection using VBScript

schreib im newsbeitrag...

Quote:

> > I thought of using a check for IP address approach, but I'm hoping
> > there's something more elegant.

> RASDIAL.EXE with no arguments gives the current connection in a string, or "No
> connections", so you can check on this output.

> Bill Stewart has a free utility:
> http://www.oregonclassifieds.net/utilities/files/tools2.zip

> Example code:
> Set oShell = CreateObject("Wscript.Shell")

> If oShell.Run("rasconns.exe", 0, True) > 0 Then
>   MsgBox "Connected by RAS"
> End If

> For Win98/WinMe:
> RASStatus method in the free WSHRas OCX at Born's WSH-Bazaar Look under ActiveX
> Controls):

> http://www.borncity.de/WSHBazaar/WSHBazaar.htm

> From a previous thread:

> <qoute>

> Subject: Re: Dial Up Connection
> Newsgroups: microsoft.public.scripting.wsh
> Date: 2000-10-24 02:24:28 PST

> This would work on a Win9x or WinMe system, but probably not for NT or Win2K
> (not tested for those):

> Set ws = WScript.CreateObject("WScript.Shell")
> RegKey = "HKLM\System\CurrentControlSet\Services" &
>          "\RemoteAccess\Remote Connection"
> If ws.RegRead(RegKey)(0) = 1 Then
>   MsgBox "Already Connected"
> Else
>   MsgBox "Not Connected"
> End If

> --
> Bill James
> Microsoft MVP?DTS

> </qoute>

> --
> torgeir

Thank you very much for the reply.  I'll check out the utility you
recommend and see how well that goes.  

As for the "previous thread" script, I did stumble across Bill James'
page while doing an internet search and tried out the script.  The
script choked trying to read the regkey -- seems I have no such key
(running Win2K).  I'm unfamiliar with the ControlSet group so maybe you
can offer a comment in that regard.

Cheers.



Sat, 07 Aug 2004 11:06:04 GMT  
 Detect DUN connection using VBScript

Quote:

> As for the "previous thread" script, I did stumble across Bill James'
> page while doing an internet search and tried out the script.  The
> script choked trying to read the regkey -- seems I have no such key
> (running Win2K).  I'm unfamiliar with the ControlSet group so maybe you
> can offer a comment in that regard.

Well as Bill James says in the article: "This would work on a Win9x or WinMe system,
but probably not for NT or Win2K"

--
torgeir



Sat, 07 Aug 2004 18:36:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Detecting Open DUN Connection

2. using vb to start a DUN connection

3. detecting connection speed via vbscript

4. Test DUN connection

5. Actuating DUN connection in W2000?

6. Are the properties of a DUN connection scriptable?

7. RAS OR DUN Connection Detection

8. dun connections

9. How to launch DUN connection

10. Starting a DUN connection win VBS script

11. Calling a DUN connection...

12. DUN connection detection

 

 
Powered by phpBB® Forum Software