mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Update check-vpn.ps1
This commit is contained in:
parent
d23eebc023
commit
3ac262573a
@ -1,8 +1,8 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the VPN connections
|
||||
Checks the VPN connection(s)
|
||||
.DESCRIPTION
|
||||
This PowerShell script checks the status of all available VPN connections.
|
||||
This PowerShell script queries and prints the status of any VPN connection.
|
||||
.EXAMPLE
|
||||
PS> ./check-vpn
|
||||
.LINK
|
||||
@ -13,12 +13,16 @@
|
||||
|
||||
try {
|
||||
$FoundOne = $false
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
$Connections = (Get-VPNConnection)
|
||||
foreach($Connection in $Connections) {
|
||||
"✅ VPN $($Connection.Name) is $($Connection.ConnectionStatus)."
|
||||
$FoundOne = $true
|
||||
}
|
||||
if (!$FoundOne) { "⚠️ No VPN connection configured" }
|
||||
}
|
||||
if (!$FoundOne) { "⚠️ No VPN connection." }
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user