Test Vpn With Powershell

usecase

The concern is documenting my attempts to automatically authenticate to hashicorp stack with the start of the terminal — but sometimes I am out of VPN. The need is to check for VPN fast

1. find the VPN adapter

  • go to network and sharing center

Control Panel\Network and Internet\Network Connections

  • rename the VPN adapter to , see below

2. use the bracket notation to check for properties

  • connected to the VPN is
  • disconnedted is , for example (the alias is already renamed adapter):
(Get-NetIPConfiguration -InterfaceAlias "vpn").NetAdapter.status
Disconnected

3. sources