Test Vpn With Powershell

Pavol Kutaj
Dec 18, 2020

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 vpn, see below

2. use the bracket notation to check for properties

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

3. sources

--

--

Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com