Update check-ping.ps1 and check-vpn.ps1

This commit is contained in:
Markus Fleschutz 2022-10-10 08:37:10 +02:00
parent 3375e6db6e
commit 78232dacf7
2 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ try {
$Avg += $Latency $Avg += $Latency
} }
$Avg = $Avg / $Pings.count $Avg = $Avg / $Pings.count
"✅ Ping is $($Avg)ms average ($($Min)ms min, $($Max)ms max)." "✅ Ping is $($Avg)ms average, $($Min)ms minimum, $($Max)ms maximum."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -15,10 +15,10 @@ try {
$FoundOne = $false $FoundOne = $false
$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 $FoundOne = $true
} }
if (!$FoundOne) { throw "No VPN connection available" } if (!$FoundOne) { "⚠️ No VPN connection configured" }
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"