Windows 10: How to programmatically connect/disconnect a Windows 10 VPN connection?

Discus and support How to programmatically connect/disconnect a Windows 10 VPN connection? in Windows 10 Customization to solve the problem; I have self-written app in C++ that needs to connect specified VPN connection on my PC the standard Windows VPN connection. When I had Windows 7 the... Discussion in 'Windows 10 Customization' started by shaniali35k, Jul 6, 2021.

  1. How to programmatically connect/disconnect a Windows 10 VPN connection?


    I have self-written app in C++ that needs to connect specified VPN connection on my PC the standard Windows VPN connection. When I had Windows 7 the app did this by getting IShellFolder pointer for the Network connections folder, then requested IContextMenu pointer for the specified connection and then called the InvokeCommand method using the 2 as command ID which corresponded to the "Connect" item. It worked OK.But now I moved to Windows 10 and this method does not work anymore - even if you open the Network Connections folder manually, right click the VPN connection and select "Connect

    :)
     
    shaniali35k, Jul 6, 2021
    #1

  2. Windows 10 Ethernet connection randomly disconnects

    Drivers and certain antivirus software or vpn related stuff.
     
    eidairaman1, Jul 6, 2021
    #2
  3. aj99000 Win User
    No Internet Connection When VPN Is Connected

    This particular issue has been going on for almost a month now. My companies IT department is still trying to figure out the root cause. Below is a list of isolation / troubleshooting i've done.

    Issue: Once connected to the work VPN (successfully) the internet connection on the Windows 10 machine disconnects and does not allow any network traffic.

    OS: Windows 10 Home - Version: 1909 (OS Build 18363.476)

    Computer: Razor Blade 2019

    - Latest drivers installed

    - Latest Windows updates installed

    - System Wide issue

    Troubleshooting / Isolation

    • Cellular Data: Verified the Windows machine can connect to a hotspot and successfully browse the internet. (No VPN involved)

    • Cellular Data + Work VPN: Verified the Windows machine can connect to the hotspot & successfully connect to work VPN and successfully browse the internet.

    • Home WiFi: Verified Windows machine can connect to the home wifi network and successfully browse the internet (No VPN involved)

    • Home WiFi + Work VPN: Verified Windows machine can connect to home WiFi. It can successfully connect to work VPN. However once the work VPN is connected, the home WiFi network indicates (No Internet Access)

    • Ping Test + Work VPN: Verified I can successfully ping (work) websites and even the work VPN URL successfully without any packet loss. However once I go to ping (non-work) related addresses like google.com, apple.com etc. there is packet loss.

    At this point I decided to test my work VPN on my iPhone & Apple Mac.

    • iPhone: Home WiFi + Work VPN: Verified the iPhone successfully connects to home WiFi network and the work VPN and can successfully browse the internet.

    • Mac: Home WiFi + Work VPN: Verified the Mac successfully connects to home WiFi network and the work VPN and can successfully browse the internet.

    Isolated: Only the Windows machine seems to be affected. I even verified this issue occurs on multiple Windows user accounts on the Windows 10 machine.

    - Windows 10 is fully updated to the latest November Windows 10 update and issue persists

    - Deleted and Added the VPN configuration several times and issue persisted.

    Third Party VPN Client Test: Tested with Nord VPN and the Windows machine successfully connected to the home WiFi network & the Nord VPN connection successfully connected to a random server and successfully browsed the internet.

    - Disabled IPV6 on VPN & WiFi network configuration (Per IT Support guidance) and issue persisted

    *Currently updating to Windows 10 Insider Preview 19033.1 (vb_release) to see if this might fix anything pertaining to Windows 10 VPN.

    Thanks for any additional guidance / suggestions / help that the community offers.
     
    aj99000, Jul 6, 2021
    #3
  4. Aquinus Win User

    How to programmatically connect/disconnect a Windows 10 VPN connection?

    Windows 10 Ethernet connection randomly disconnects

    I suggest checking out the event log in Windows. It's likely going to tell you why (to some degree,) why the network connection was lost. I haven't had this issue with wired connections but, with wireless it has almost always come down to drivers or a strange software bug which boiled down to how the driver operates.
     
    Aquinus, Jul 6, 2021
    #4
Thema:

How to programmatically connect/disconnect a Windows 10 VPN connection?

Loading...
  1. How to programmatically connect/disconnect a Windows 10 VPN connection? - Similar Threads - programmatically connect disconnect

  2. Fix VPN Connection, Can’t connect to VPN connection error on Windows 11/10

    in Windows 10 News
    Fix VPN Connection, Can’t connect to VPN connection error on Windows 11/10: [ATTACH]Amongst various VPN connection problems and issues you may encounter on your Windows 11 or Windows 10 PC could be the general error message Can’t connect to VPN connection with the full error message as follows: VPN Connection, Can’t connect to VPN connection, A...
  3. Windows 11 VPN connect after successfully connected disconnection won't connect again to...

    in Windows 10 Gaming
    Windows 11 VPN connect after successfully connected disconnection won't connect again to...: In Windows 11, MS VPN connect after successfully connected disconnection, won't connect again to same or another VPN. Message says, I must check network, but only successfully connect is posible after restart PC. Same problem I have with another computer with windows 10...
  4. Windows 11 VPN connect after successfully connected disconnection won't connect again to...

    in Windows 10 Software and Apps
    Windows 11 VPN connect after successfully connected disconnection won't connect again to...: In Windows 11, MS VPN connect after successfully connected disconnection, won't connect again to same or another VPN. Message says, I must check network, but only successfully connect is posible after restart PC. Same problem I have with another computer with windows 10...
  5. connection disconnects if i try to connect a vpn

    in Windows 10 Network and Sharing
    connection disconnects if i try to connect a vpn: Hi, iam trying to connect through a vpn app, when ever i try to connect ping goes signed out then general failure is there a fix for that, i tried on wifi and usb dongle and usb internet cable [ATTACH]...
  6. Fix VPN connects and then automatically disconnects on Windows 10

    in Windows 10 News
    Fix VPN connects and then automatically disconnects on Windows 10: [ATTACH] [ATTACH]VPN is a very useful feature for modern computers in today’s times. It helps commercial as well as non-commercial users in many ways. For commercial or corporate users, they can access their company’s private servers using this VPN connection, whereas [...]...
  7. When VPN Connects, WiFi Disconnects

    in Windows 10 Network and Sharing
    When VPN Connects, WiFi Disconnects: Thank you for taking a look at my thread.. This has never been an issue that I am aware of.... but... when I connect my VPN my wifi seems to disconnect. When I disconnect VPN the Wifi resumes. My settings haven't changed and its always been fine. Now I see that if I enter...
  8. How to configure VPN connection to connect automatically

    in Windows 10 Network and Sharing
    How to configure VPN connection to connect automatically: I have a VPN that I wish to connect to every time I start the system, instead of starting it manually. How can I do that in Windows 10 (I'm fairly sure it could be done in Windows 7)? Thanks Dave 83980
  9. How to connect/disconnect to a VPN using the command line?

    in Windows 10 Network and Sharing
    How to connect/disconnect to a VPN using the command line?: Hi all I have several network connections configured. There is one wifi connection which automatically connects to my WLAN, another cable based LAN connection to a NAS which is used for backups and some L2TP connection connections (used for VPN if needed). Is there...
  10. Connect to VPN in Windows 10

    in Windows 10 Tutorials
    Connect to VPN in Windows 10: How to: Connect to VPN in Windows 10 How to Connect to a VPN in Windows 10 [img] Information Whether it's for work or personal use, you can connect to a VPN (virtual private network) on your Windows 10 PC. A VPN connection can help provide a more secure connection to...