2021-12-02 14:49:17 +01:00
|
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
2021-12-03 10:12:56 +01:00
|
|
|
|
Checks the VPN connections
|
2021-12-02 14:49:17 +01:00
|
|
|
|
.DESCRIPTION
|
2022-01-29 12:47:46 +01:00
|
|
|
|
This PowerShell script checks the status of all available VPN connections.
|
2021-12-02 14:49:17 +01:00
|
|
|
|
.EXAMPLE
|
|
|
|
|
PS> ./check-vpn
|
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
|
.NOTES
|
2022-01-29 12:47:46 +01:00
|
|
|
|
Author: Markus Fleschutz / License: CC0
|
2021-12-02 14:49:17 +01:00
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
try {
|
2021-12-07 12:07:23 +01:00
|
|
|
|
$FoundOne = $false
|
2021-12-02 14:49:17 +01:00
|
|
|
|
$Connections = (Get-VPNConnection)
|
|
|
|
|
foreach($Connection in $Connections) {
|
2021-12-07 12:07:23 +01:00
|
|
|
|
& "$PSScriptRoot/give-reply.ps1" "VPN $($Connection.Name) is $($Connection.ConnectionStatus)."
|
|
|
|
|
$FoundOne = $true
|
2021-12-02 14:49:17 +01:00
|
|
|
|
}
|
2021-12-07 12:07:23 +01:00
|
|
|
|
if (!$FoundOne) { throw "No VPN connection available" }
|
|
|
|
|
exit 0
|
2021-12-02 14:49:17 +01:00
|
|
|
|
} catch {
|
2021-12-07 12:07:23 +01:00
|
|
|
|
& "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])."
|
2021-12-02 14:49:17 +01:00
|
|
|
|
exit 1
|
|
|
|
|
}
|