Deleting an Always On VPN Device Tunnel

Deleting an Always On VPN Device TunnelWindows 10 Always On VPN supports both a user tunnel for corporate network access, and a device tunnel typically used to provide pre-logon network connectivity and to support manage out scenarios. The process of testing Always On VPN is often an iterative one involving trial and error testing to fine tune the configuration parameters to achieve the best experience. As a part of this process it will often be necessary to delete a connection at some point. For the user tunnel the process is simple and straightforward. Simply disconnect the session and delete the connection in the UI.

Deleting an Always On VPN Device Tunnel

Deleting a device tunnel connection presents a unique challenge though. Specifically, there is no VPN connection in the UI to disconnect and remove. To delete an Always On VPN device tunnel, open an elevated PowerShell window and enter the following command.

Get-VpnConnection -AllUserConnection | Remove-VpnConnection -Force

If the device tunnel is connected when you try to remove it, you will receive the following error message.

The VPN connection [connection_name] cannot be removed from the global user connections. Cannot
delete a connection while it is connected.

Deleting an Always On VPN Device Tunnel

The device tunnel must first be disconnected to resolve this issue. Enter the following command to disconnect the device tunnel.

rasdial.exe [connection_name] /disconnect

Remove the device tunnel connection using PowerShell once complete.

Deleting an Always On VPN Device Tunnel
Additional Resources

Windows 10 Always On VPN Device Tunnel Step-by-Step Configuration using PowerShell

What’s The Difference Between DirectAccess and Always On VPN?

Windows 10 Always On VPN Recommendations for Windows Server 2016 Routing and Remote Access Service (RRAS)

Windows 10 Always On VPN Hands-On Training

Leave a comment


  1. Andy

     /  April 6, 2018

    rasphone -R “Device Tunnel” seems to work with one command

  2. Mike

     /  May 14, 2018

    If I run the command to disconnect the Device Tunnel, it says “No Connections”. Then if I try to remove it, it says it “cannot delete a connection while it is connected”. 1803.

    • Odd. Make sure that if your VPN connection name has spaces in it that you use quotes for it. Other than that, disconnecting with rasdial.exe should absolutely work. 🙂

      • Daniel Bolton

         /  November 8, 2018

        Hi, is there a way to close a devicetunnel without running the command as administrator? I seem to be unable to close the tunnel unless I execute the commend from an elevated command prompt? Thanks 🙂

      • I don’t believe so. As the device tunnel runs in the context of the system account, you’ll almost certainly required administrative rights to do anything with it.

  3. Daniel Bolton

     /  November 12, 2018

    Thanks Richard, that was my feeling also 🙂 Could I ask another question. We have managed to deploy both Device and User tunnels without any issues. My understanding from MS is that you can run a Device tunnel, then launch a User tunnel at the same time on the same machine; perhaps to allow additional access to internal systems based upon VPN IP address/subnet. The User tunnel launches fine, the Device tunnel drops….then the User tunnel drops and the Device tunnel connects again. We have logged this issue with MS and it is looking like a bug, but I wondered if you had seen this yourself and if you had any information or guidance? Thanks, Danny

  1. Always On VPN RasMan Device Tunnel Failure | Richard M. Hicks Consulting, Inc.
  2. Always On VPN Device Tunnel Missing in Windows 10 UI | Richard M. Hicks Consulting, Inc.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: