mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-15 04:24:01 +01:00
Update check-vpn.ps1
This commit is contained in:
parent
9b8bd116e6
commit
515369b938
@ -5,7 +5,7 @@
|
||||
This PowerShell script queries the status of the VPN connections and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-vpn
|
||||
✅ VPN 'NASA L2TP' is Disconnected
|
||||
✅ Disconnected VPN 'NASA L2TP'
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -19,13 +19,13 @@ try {
|
||||
} else {
|
||||
$Connections = Get-VPNConnection
|
||||
foreach($Connection in $Connections) {
|
||||
Write-Host "✅ VPN '$($Connection.Name)' is $($Connection.ConnectionStatus)"
|
||||
"✅ $($Connection.ConnectionStatus) VPN '$($Connection.Name)'"
|
||||
$NoVPN = $false
|
||||
}
|
||||
}
|
||||
if ($NoVPN) { Write-Host "⚠️ No VPN connection" }
|
||||
if ($NoVPN) { "⚠️ No VPN" }
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user