How to automatically connect VPN to specific apps on Windows 10
With Windows 10 PowerShell (cmdlets), you can easily add applications to automatically activate VPN connections when they launch. Automating this task means you won't have to worry about connecting to a VPN when using certain apps.
To take advantage of this functionality in PowerShell, you will first need to add a VPN service to your computer if you don't already have one. Check out the article: How to create a VPN on Windows 10 for how to do it.
How to add automatic VPN activation feature
After establishing a VPN connection on Windows 10, you will need to open PowerShell as an administrator.

Click Yes right in the prompt that appears to allow access to the computer.
In the PowerShell window, enter the following command, then replace and with the name of the VPN connection, plus the file path to the application you want to use, respectively:
Add-VpnConnectionTriggerApplication -Name "" –ApplicationID ""
Note include the quotes in the command.
Hit Enter
to run the command. PowerShell warns you that Split tunneling is disabled by default. To continue, you must confirm and enable this feature first.
Type Y
when the prompt appears, then press Enter
again to finish.

You must enable Split tunneling to enable automatic connection to the VPN without human intervention.
Split tunneling prevents Windows from routing all network traffic through the VPN, when the application activates it to start. Instead, split tunneling divides the traffic and only data from the listed application is transferred over the VPN.
Enter the following command in PowerShell:
Set-VpnConnection -Name "" -SplitTunneling $True
. and replace with the name of your VPN (note the quotation marks), then press Enter
.
Next, in case you accidentally close the application and do not want the connection to terminate, you can set the timeout buffer to restart the application.
Import:
Set-VpnConnection -Name "" -IdleDisconnectSeconds
. go to PowerShell and press Enter
. Replace with your connection name and with the number of seconds to wait until the connection is terminated.
Now, when the application closes, Windows will wait 10 seconds before terminating the VPN connection. You can change this number as you like or skip this step altogether.
How to see which apps automatically activate VPN
There are several ways you can check to see which applications have been installed to automatically activate the VPN connection. You can use a command in PowerShell or edit the phonebook file in File Explorer.
If the VPN suddenly starts and you're not sure why, you can use one of the following methods to determine which application has enabled it.
Use a PowerShell cmdlet
To use this method, click the Start button and enter Powershell. Right-click on Windows PowerShell and then select Run as Administrator from the menu.
Click Yes right in the prompt that appears to allow access to the computer.
In the PowerShell window, enter the following command, but replace it with your VPN connection name, then press Enter
:
Get-VpnConnectionTrigger -ConnectionName
Use File Explorer
Another option is to track dial-up phonebook files in File Explorer. You can open it in a text editor and see the list of VPN enabled apps.
The phonebook file provides a standard way for Windows to collect and specify the information needed for setting up Remote Access Connection (RAS). This file contains information such as IP address, port, modem settings and information you are looking for about applications that can trigger connections.
To get started, open File Explorer and paste the following folder in the address bar, but replace it with the current username, then press Enter
:
C:UsersAppDataRoamingMicrosoftNetworkConnectionsPbk
Right-click on 'rasphone.pbk' and then select the text editor in which you want to open the file.

This file contains all the VPN connections on your computer, so if you have multiple VPNs, you may have to sift through a lot to find the applications you want. Each application is stored in the 'ClassicApplicationIDs' function as the direct file path.
Fortunately, if you don't want to scroll through each application, most text editors have a Find feature. Press Ctrl
+ F
, type 'ClassicApplicationIds' into the text field, then press Enter
.

How to remove the automatic VPN activation feature
If you accidentally add a wrong application or no longer want a VPN to activate when launching specific applications, you can delete them using a similar cmdlet in PowerShell.
To remove the automatic VPN activation feature, open Powershell with admin rights.
Click Yes in the prompt that appears to allow access to the computer.
In the PowerShell window, enter the following, but replace and with the name of the VPN connection plus the path to the corresponding application:
Remove-VpnConnectionTriggerApplication -Name "" –ApplicationID ""
PowerShell prompts you to confirm deletion of the application from the automatic activation list. Type Y
and press Enter
.
Repeat this step for every application you want to remove from the list.
You should read it
- Is Auto-GPT worth using without GPT-4?
- Instructions to fix Wi-Fi connection error on iOS 6
- Turn off the Win 10 update, stop Windows 10 from updating automatically
- The fastest and simplest way to turn on Auto HDR on Windows 11
- How to enable / disable Ethernet connection measurement feature in Windows 10
- How to fix errors Your connection is not a private connection
- Auto Click and how to automatically click when playing games
- Internet connection sharing - Internet Connection Sharing
May be interested
- Disable / enable Hardware Accelerated GPU Scheduling in Windows 10if the graphics card and driver for windows 10 computers support hardware acceleration, you can turn on the hardware accelerated gpu scheduling feature to reduce latency and improve performance.
- How to fix Clock Watchdog Timeout errors in Windows 10clock watchdog timeout is a blue screen of death that microsoft windows users may encounter. there are several potential causes and solutions for this rare problem.
- How to move apps and programs installed in Windows 10if you've installed a lot of apps and programs on your windows 10 system, you might want to move them to another drive to free up space. you may also need to change your default installation location.
- How to enable / disable Ethernet connection measurement feature in Windows 10metered connection is an internet connection with limited data related to it. mobile data connections are set by default. wifi and ethernet network connections can be measured, but this option is not enabled by default.
- How to bring Spotlight Search macOs to Windows 10spotlight search feature can bring up windows 10 with a simple implementation.
- How to turn off the hard drive after not working in Windows 10installing turn off hard disk after in power options allows the user to set the power to the hard drive (hdd) to be turned off, after detecting it has been inactive for a period of time. this setting will not affect ssd or nvme drives.