mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 01:43:37 +01:00
Update check-vpn.ps1
This commit is contained in:
parent
345da64609
commit
f8159e0769
@ -2,10 +2,10 @@
|
||||
.SYNOPSIS
|
||||
Checks the VPN status
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries and prints the status of the VPN connection(s).
|
||||
This PowerShell script queries the status of the VPN connection(s) and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-vpn.ps1
|
||||
✅ VPN to NASA L2TP is disconnected
|
||||
✅ VPN disconnected to NASA L2TP
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -13,17 +13,17 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$NoVPN = $true
|
||||
$noVPN = $true
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
$Connections = Get-VPNConnection
|
||||
foreach($Connection in $Connections) {
|
||||
Write-Host "✅ VPN to $($Connection.Name) is $($Connection.ConnectionStatus.ToLower())"
|
||||
$NoVPN = $false
|
||||
Write-Host "✅ VPN $($Connection.ConnectionStatus.ToLower()) to $($Connection.Name)"
|
||||
$noVPN = $false
|
||||
}
|
||||
}
|
||||
if ($NoVPN) { Write-Host "⚠️ No VPN configured" }
|
||||
if ($noVPN) { Write-Host "⚠️ No VPN configured" }
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user