Skip to content

Check-Vpn

Checks the VPN status

try {
	$noVPN = $true
	if ($IsLinux) {
		# TODO
	} else {
		$connections = Get-VPNConnection
		foreach($connection in $connections) {
			Write-Host "? Internet VPN to $($connection.Name) is $($connection.ConnectionStatus.ToLower())"
			$noVPN = $false
		}
	}
	if ($noVPN) { Write-Host "?? No VPN configured" }
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.