2024-01-25 13:37:12 +01:00
|
|
|
Script: *list-nina-warnings.ps1*
|
|
|
|
========================
|
2023-12-07 20:24:45 +01:00
|
|
|
|
|
|
|
This PowerShell script queries the current NINA warnings and prints it.
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
----------
|
|
|
|
```powershell
|
|
|
|
PS> ./list-nina-warnings.ps1 [<CommonParameters>]
|
|
|
|
|
|
|
|
[<CommonParameters>]
|
|
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
|
|
```
|
|
|
|
|
|
|
|
Example
|
|
|
|
-------
|
|
|
|
```powershell
|
|
|
|
PS> ./list-nina-warnings.ps1
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Notes
|
|
|
|
-----
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
|
|
|
|
|
|
|
Related Links
|
|
|
|
-------------
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
|
|
|
|
Script Content
|
|
|
|
--------------
|
|
|
|
```powershell
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Lists the current NINA warnings
|
|
|
|
.DESCRIPTION
|
|
|
|
This PowerShell script queries the current NINA warnings and prints it.
|
|
|
|
.EXAMPLE
|
|
|
|
PS> ./list-nina-warnings.ps1
|
|
|
|
.LINK
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
.NOTES
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
|
|
|
#>
|
|
|
|
|
|
|
|
try {
|
|
|
|
Write-Progress "Loading NINA warnings..."
|
|
|
|
$warnings = (Invoke-WebRequest -URI https://warnung.bund.de/api31/dwd/mapData.json -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
|
|
|
|
Write-Progress -completed "Done."
|
|
|
|
Write-Output "Weather Warnings by DWD"
|
|
|
|
Write-Output "-----------------------"
|
|
|
|
foreach($warning in $warnings) {
|
|
|
|
$startDate = $warning.startDate
|
|
|
|
$expiresDate = $warning.expiresDate
|
|
|
|
$severity = $warning.severity
|
|
|
|
$urgency = $warning.urgency
|
|
|
|
$type = $warning.type
|
|
|
|
$message = $warning.i18nTitle.en
|
|
|
|
Write-Output "* $type from $startDate to $($expiresDate): $message ($severity, $urgency)"
|
|
|
|
}
|
|
|
|
exit 0 # success
|
|
|
|
} catch {
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-01-25 13:37:12 +01:00
|
|
|
*(generated by convert-ps2md.ps1 using the comment-based help of list-nina-warnings.ps1 as of 01/25/2024 13:36:52)*
|