mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Add check-vpn.ps1
This commit is contained in:
parent
3796e65120
commit
b3e6c4711f
@ -97,7 +97,7 @@ Computer, open `name` settings
|
||||
Computer, check `name`
|
||||
----------------------
|
||||
* let the computer check something.
|
||||
* replace `name` by: "CPU", "date", "DNS", "Earth", "operating system", "ping", "swap space", "time", "time zone", "up-time", or "weather".
|
||||
* replace `name` by: "CPU", "date", "DNS", "Earth", "operating system", "ping", "swap space", "time", "time zone", "up-time", "VPN", or "weather".
|
||||
|
||||
|
||||
🔊 Audio
|
||||
|
28
Scripts/check-vpn.ps1
Executable file
28
Scripts/check-vpn.ps1
Executable file
@ -0,0 +1,28 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the VPN connection(s)
|
||||
.DESCRIPTION
|
||||
This script checks the VPN connection(s).
|
||||
.EXAMPLE
|
||||
PS> ./check-vpn
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$Connections = (Get-VPNConnection)
|
||||
$Reply = ""
|
||||
foreach($Connection in $Connections) {
|
||||
$Reply += "connection $($Connection.Name) is $($Connection.ConnectionStatus), "
|
||||
}
|
||||
if ("$Reply" -eq "") { $Reply = "No VPN connection available"
|
||||
|
||||
"✔️ $Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user