Connect to VPN by Powershell

powershell, vpn

Solution

Try this works with windows 10

    $vpnName = "YOUR_VPN_NAME";
    $vpn = Get-VpnConnection -Name $vpnName;
    if($vpn.ConnectionStatus -eq "Disconnected"){
    rasdial $vpnName;
    }

Problem

I'd like my Windows to connect to the VPN server as soon as it loads. How can I do it using Powershell?

Original source

Related problems