mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-15 12:34:25 +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.
|
This PowerShell script queries the status of the VPN connections and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-vpn
|
PS> ./check-vpn
|
||||||
✅ VPN 'NASA L2TP' is Disconnected
|
✅ Disconnected VPN 'NASA L2TP'
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -19,11 +19,11 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$Connections = Get-VPNConnection
|
$Connections = Get-VPNConnection
|
||||||
foreach($Connection in $Connections) {
|
foreach($Connection in $Connections) {
|
||||||
Write-Host "✅ VPN '$($Connection.Name)' is $($Connection.ConnectionStatus)"
|
"✅ $($Connection.ConnectionStatus) VPN '$($Connection.Name)'"
|
||||||
$NoVPN = $false
|
$NoVPN = $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($NoVPN) { Write-Host "⚠️ No VPN connection" }
|
if ($NoVPN) { "⚠️ No VPN" }
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user