An Engineers Notebook

Finally, a Windows 10 VPN solution that doesn’t make you want to blow your brains out!

As a system administrator, I use many VPN connections throughout the day. Windows 10 is great, but whoever was in change of the VPN client in windows 10 at Microsoft did not deserve his/her bonus for this edition of windows!! It’s slow, buggy, gives you no decent error. Fortunately, Mr gates left the good old rasphone intact so we can use this. 

The problem is, its still clunky loading in Windows 10. It can take 3-10 seconds to load the Rasphone each time you open it.

I’ve written a PowerShell script to make a tidy folder of useable shortcuts that you can add the to tool bar. Here’s how it works.

1. Create a folder called “VPNs” in c:

2. Right click the task bar > Toolbars > New Toolbar

3. Navigate to the VPNs folder and select it and click ‘Select Folder’.

4. Paste this PS Script to s txt file. Save it as a .ps1 file.

Remove-Item -Path C:VPNs* -Recurse -Force
$vpnlist = Get-VpnConnection | Select Name -Skip 1
ForEach ($vpnname in $vpnlist.Name ){
$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut("C:VPNs$vpnname.lnk")
$ShortCut.Arguments="-d `"$vpnname`""
$ShortCut.WorkingDirectory = "c:windowssystem32";
$ShortCut.WindowStyle = 1;
$ShortCut.Description = "$vpnname";

5.You can check the status (See what VPNs are connected) with this script.

Get-VpnConnection | Where-Object {$_.ConnectionStatus -eq "Connected" } | Select Name,ConnectionStatus,TunnelType,ServerAddress,SplitTunneling | Format-Table

6. You can disconnect all VPNs at the same time with this script.

$vpnlist = Get-VpnConnection | Where-Object {$_.ConnectionStatus -eq "Connected" }
ForEach ($vpnname in $vpnlist.Name ){
  rasdial $vpnname /DISCONNECT;

Leave a Reply

Your email address will not be published.