mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-30 09:36:40 +02:00
Update check-vpn.ps1
This commit is contained in:
parent
767634fba0
commit
7b6f2b7cc2
@ -1,6 +1,6 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the VPN connection(s)
|
Checks the VPN connection
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script queries and prints the status of any VPN connection.
|
This PowerShell script queries and prints the status of any VPN connection.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@ -12,17 +12,17 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$FoundOne = $false
|
$NoVPN = $true
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
# TODO
|
# TODO
|
||||||
} else {
|
} else {
|
||||||
$Connections = (Get-VPNConnection)
|
$Connections = (Get-VPNConnection)
|
||||||
foreach($Connection in $Connections) {
|
foreach($Connection in $Connections) {
|
||||||
"✅ VPN $($Connection.Name) is $($Connection.ConnectionStatus)."
|
"✅ VPN '$($Connection.Name)' is $($Connection.ConnectionStatus)."
|
||||||
$FoundOne = $true
|
$NoVPN = $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$FoundOne) { "⚠️ No VPN connection." }
|
if ($NoVPN) { "⚠️ No VPN connection." }
|
||||||
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