≡ Menu

Check VPN connection status command line

Learn how to check VPN connection status on your Windows system from command prompt.  Netsh command is used to find connection status of different networks, including the VPN.

Run the below command to find the VPN status

c:\>netsh interface show interface

An example run on my Windows 7 computer when I am connected to VPN.

c:\>netsh interface show interface

Admin State    State          Type             Interface Name
-------------------------------------------------------------------------
Enabled        Disconnected   Dedicated        Wireless Network Connection
Enabled        Connected      Dedicated        Local Area Connection
Enabled        Connected      Dedicated        Cisco AnyConnect Secure Mobility
                                                  Client Connection

I use Cisco AnyConnect to VPN connect, and the netsh command shows that it’s connected currently!

Even if you use a different VPN client, you should have a corresponding network adapter added into your network connections list. Run the above command and figure out your VPN connection and know it’s connection status.

3 comments… add one
  • MazTerGee

    Thanks for the tip

  • Brian

    With this I can keep monitoring if VPN is connected/disconnected from cmd and then I can trigger a custom command when it goes to disconnected state.

  • Patrick

    @Brian, To re-connect the VPN when it gets disconnected, you can use Task Scheduler in Start-Accessories-System-Task Scheduler to set up a Task that triggers on Event Application-Rasclient-20226. The Task will run a batch file that reconnects the VPN with a batch file that attempts to re-connect the VPN with a command prompt Rasclient command. Event 20226 is the event triggered when the VPN disconnects. The batch file should attempt to reconnect several times, pausing between attempts and fail after a set number of attempts.

Cancel reply

Leave a Comment