Skip to content

Instantly share code, notes, and snippets.

@denegny
Created June 26, 2023 19:32
Show Gist options
  • Select an option

  • Save denegny/c8b4cf72b4bdf8bbdb55c4daa7b2ecc9 to your computer and use it in GitHub Desktop.

Select an option

Save denegny/c8b4cf72b4bdf8bbdb55c4daa7b2ecc9 to your computer and use it in GitHub Desktop.
powerShell VPN conn on/off
$vpnName = Get-VpnConnection | select -first 1 -ExpandProperty Name;
∙ $vpn = Get-VpnConnection -Name $vpnName;
∙ if($vpn.ConnectionStatus -eq "Disconnected"){
∙ rasdial $vpnName;
∙ }
∙ else {rasdial $vpnName /DISCONNECT;}
∙ Get-VpnConnection;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment