title: How to Disconnect VPN in Windows Via Powershell
body: <p>I'm always connecting and disconnecting to my VPN and I have a powershell script that connects to the VPN profile and it's brilliant. I dont have to type anything just run it. </p>
  
  <p>However, I always needed to disconnected via the convoluted GUI. </p>
  
  <p>The awesome script I use to connect goes something like:</p>
  
  <pre><code>$vpnName = "MyVPN";
      $vpn = Get-VpnConnection -Name $vpnName;
      if($vpn.ConnectionStatus -eq "Disconnected"){
      rasdial $vpnName;
      }
  </code></pre>
  
  <p>Is there a way to do the opposite?</p>
  
  <p>I cannot seem to find any way of disconnecting via powershell. I cannot use third party software and I can't seem to find anything in PS get-help Vpnconnection that disconnects.</p>