-
-
Save denegny/c8b4cf72b4bdf8bbdb55c4daa7b2ecc9 to your computer and use it in GitHub Desktop.
powerShell VPN conn on/off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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