mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Update check-vpn.ps1
This commit is contained in:
parent
d23eebc023
commit
3ac262573a
@ -1,8 +1,8 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the VPN connections
|
Checks the VPN connection(s)
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script checks the status of all available VPN connections.
|
This PowerShell script queries and prints the status of any VPN connection.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-vpn
|
PS> ./check-vpn
|
||||||
.LINK
|
.LINK
|
||||||
@ -13,12 +13,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$FoundOne = $false
|
$FoundOne = $false
|
||||||
$Connections = (Get-VPNConnection)
|
if ($IsLinux) {
|
||||||
foreach($Connection in $Connections) {
|
# TODO
|
||||||
"✅ VPN $($Connection.Name) is $($Connection.ConnectionStatus)."
|
} else {
|
||||||
$FoundOne = $true
|
$Connections = (Get-VPNConnection)
|
||||||
|
foreach($Connection in $Connections) {
|
||||||
|
"✅ VPN $($Connection.Name) is $($Connection.ConnectionStatus)."
|
||||||
|
$FoundOne = $true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!$FoundOne) { "⚠️ No VPN connection configured" }
|
if (!$FoundOne) { "⚠️ 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