mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-26 22:36:12 +01:00
Update check-vpn.ps1
This commit is contained in:
parent
767634fba0
commit
7b6f2b7cc2
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the VPN connection(s)
|
||||
Checks the VPN connection
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries and prints the status of any VPN connection.
|
||||
.EXAMPLE
|
||||
@ -12,17 +12,17 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$FoundOne = $false
|
||||
$NoVPN = $true
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
$Connections = (Get-VPNConnection)
|
||||
foreach($Connection in $Connections) {
|
||||
"✅ VPN $($Connection.Name) is $($Connection.ConnectionStatus)."
|
||||
$FoundOne = $true
|
||||
"✅ VPN '$($Connection.Name)' is $($Connection.ConnectionStatus)."
|
||||
$NoVPN = $false
|
||||
}
|
||||
}
|
||||
if (!$FoundOne) { "⚠️ No VPN connection." }
|
||||
if ($NoVPN) { "⚠️ No VPN connection." }
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user