mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 13:04:59 +02:00
Add check-vpn.ps1
This commit is contained in:
28
Scripts/check-vpn.ps1
Executable file
28
Scripts/check-vpn.ps1
Executable file
@ -0,0 +1,28 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the VPN connection(s)
|
||||
.DESCRIPTION
|
||||
This script checks the VPN connection(s).
|
||||
.EXAMPLE
|
||||
PS> ./check-vpn
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$Connections = (Get-VPNConnection)
|
||||
$Reply = ""
|
||||
foreach($Connection in $Connections) {
|
||||
$Reply += "connection $($Connection.Name) is $($Connection.ConnectionStatus), "
|
||||
}
|
||||
if ("$Reply" -eq "") { $Reply = "No VPN connection available"
|
||||
|
||||
"✔️ $Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
Reference in New Issue
Block a user