Fordraiders
asked on
check for cisco vpn connection...enabled or disabled
I have a CISCO Vpn anyconnect secure mobility client.
v 3.1.02040
Does any one know of a way in vba to check and see if a vpn connection is established or not ?
Thanks
fordraiders
v 3.1.02040
Does any one know of a way in vba to check and see if a vpn connection is established or not ?
Thanks
fordraiders
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
als315, This is passing any test i give it. Off or on vpn ?
ASKER
nm, this worked for now.
Function IsVPNConnected()
IsVPNConnected = False
sComputer = "."
Set oWMIService = GetObject("winmgmts:\\" _
& sComputer & "\root\CIMV2")
Set colItems = oWMIService.ExecQuery( _
"SELECT * FROM Win32_NetworkAdapterConfig uration", , 48)
For Each objItem In colItems
'Please check description of your VPN Connection by running command "ipconfig /all" on command-line.
If (InStr(objItem.Description , "AnyConnect")) Then
IsVPNConnected = objItem.IPEnabled
End If
Next
If (IsVPNConnected) Then
IsVPNConnected = MsgBox("I am Connected to VPN.")
Else
IsVPNConnected = MsgBox("I am Not Connected to VPN.")
End If
End Function
Function IsVPNConnected()
IsVPNConnected = False
sComputer = "."
Set oWMIService = GetObject("winmgmts:\\" _
& sComputer & "\root\CIMV2")
Set colItems = oWMIService.ExecQuery( _
"SELECT * FROM Win32_NetworkAdapterConfig
For Each objItem In colItems
'Please check description of your VPN Connection by running command "ipconfig /all" on command-line.
If (InStr(objItem.Description
IsVPNConnected = objItem.IPEnabled
End If
Next
If (IsVPNConnected) Then
IsVPNConnected = MsgBox("I am Connected to VPN.")
Else
IsVPNConnected = MsgBox("I am Not Connected to VPN.")
End If
End Function
ASKER