Update check-vpn.ps1

This commit is contained in:
Markus Fleschutz 2023-07-17 11:25:30 +02:00
parent e5b66841dc
commit 1efe1f73eb
3 changed files with 13 additions and 11 deletions

View File

@ -2,10 +2,10 @@
.SYNOPSIS .SYNOPSIS
Checks the VPN status Checks the VPN status
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the status of the VPN connection(s) and prints it. This PowerShell script queries and prints the status of the VPN connection(s).
.EXAMPLE .EXAMPLE
PS> ./check-vpn PS> ./check-vpn.ps1
VPN to NASA L2TP: Disconnected VPN to NASA L2TP is disconnected
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -19,11 +19,11 @@ try {
} else { } else {
$Connections = Get-VPNConnection $Connections = Get-VPNConnection
foreach($Connection in $Connections) { foreach($Connection in $Connections) {
"✅ VPN to $($Connection.Name): $($Connection.ConnectionStatus)" Write-Host "✅ VPN to $($Connection.Name) is $($Connection.ConnectionStatus.ToLower())"
$NoVPN = $false $NoVPN = $false
} }
} }
if ($NoVPN) { "⚠️ No VPN" } if ($NoVPN) { Write-Host "⚠️ No VPN" }
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -2,11 +2,12 @@
.SYNOPSIS .SYNOPSIS
Writes text in lowercase letters Writes text in lowercase letters
.DESCRIPTION .DESCRIPTION
This PowerShell script writes text in lowercase letters. This PowerShell script writes the given text in lowercase letters.
.PARAMETER text .PARAMETER text
Specifies the text to write Specifies the text to write
.EXAMPLE .EXAMPLE
PS> ./write-lowercase "Hello World" PS> ./write-lowercase "Hello World"
hello world
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -15,7 +16,7 @@
param([string]$text = "") param([string]$text = "")
if ($text -eq "" ) { $text = read-host "Enter the text to write" } if ($text -eq "" ) { $text = Read-Host "Enter the text to write" }
write-output $text.ToLower() Write-Output $text.ToLower()
exit 0 # success exit 0 # success

View File

@ -2,11 +2,12 @@
.SYNOPSIS .SYNOPSIS
Writes text in uppercase letters Writes text in uppercase letters
.DESCRIPTION .DESCRIPTION
This PowerShell script writes text in uppercase letters. This PowerShell script writes the given text in uppercase letters.
.PARAMETER text .PARAMETER text
Specifies the text to write Specifies the text to write
.EXAMPLE .EXAMPLE
PS> ./write-uppercase "Hello World" PS> ./write-uppercase "Hello World"
HELLO WORLD
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -15,7 +16,7 @@
param([string]$text = "") param([string]$text = "")
if ($text -eq "" ) { $text = read-host "Enter the text to write" } if ($text -eq "" ) { $text = Read-Host "Enter the text to write" }
write-output $text.ToUpper() Write-Output $text.ToUpper()
exit 0 # success exit 0 # success