This topic contains 5 replies, has 3 voices, and was last updated by
December 16, 2015 at 10:56 pm #33070
I am new to powershell, have completed the 6 hours course recently, i am currently developing small tool, i want to check our vpn status whether connected or not,
i have used
gwmi win32_networkadapterconfiguration -Filter 'Description="MyVPN Adapter"' | ft IPEnabled
Shows as false even if the vpn is connected, how to detect the status, please help me out.
Thanks in advance
December 17, 2015 at 1:21 pm #33095ParticipantPoints: 148Rank: Participant
If it's showing False and you're truly connected using your VPN adapter, then my assumption is that 'MyVPN Adapter,' or whatever it's called, is not the adapter you actually want. I use the Cisco AnyConnect VPN, and its IPEnabled property is listed as True. Have you run a more general command, to see more results, such as: Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Select-Object Description,IPEnabled. What does this list when your VPN adapter is connected and not connected?
December 17, 2015 at 10:26 pm #33102
First of all thanks for your kind support,
We use Aventail VPN and I get false for the both while connected and disconnected, and FYI I am checking this in my company, not my personal.
gwmi win32_networkadapterconfiguration -Filter 'Description="Aventail VPN Adapter"' | Select-Object Description,IPEnabled
Aventail VPN Adapter False
December 18, 2015 at 7:35 am #33117ParticipantPoints: 148Rank: Participant
Since the status of your VPN adapter isn't properly represented in the Win32_NetworkAdapterConfiguration class, I would view this as a vendor support issue. You should contact the people that make Aventail VPN for assistance with how to determine if there's an active VPN connection, or not. You might also try and determine if their product ships with a command line tool that would report this type of information. If so, you may be able to leverage this in PowerShell.
December 18, 2015 at 8:17 am #33118ParticipantPoints: 21Rank: Member
some really simple alternate tests.
test-connection to one of your servers on the vpn network
December 20, 2015 at 11:23 pm #33173
Thanks Dan Potter,
'test-connection' Alternate way worked out for me, I have got server name, so when VPN connected I get reply, when not connected it throws error, so this way is ok for me to see if VPN is connected or NOT.
Once again thanks Dan Potter!!!
and thanks to Tommy for your time to reply
The topic ‘To Check the status of VPN Connection’ is closed to new replies.