Update list-os-updates.ps1

This commit is contained in:
Markus Fleschutz 2023-04-12 14:02:15 +02:00
parent 4f10d8d310
commit aa1fd24f18

View File

@ -1,8 +1,8 @@
<#
.SYNOPSIS
Lists the latest operating system updates
Lists OS updates
.DESCRIPTION
This PowerShell script lists the latest operating system update news.
This PowerShell script lists the latest updates for operating systems.
.PARAMETER RSS_URL
Specifies the URL to the RSS feed
.PARAMETER MaxCount
@ -15,19 +15,22 @@
Author: Markus Fleschutz | License: CC0
#>
param([string]$RSS_URL = "https://distrowatch.com/news/dwd.xml", [int]$MaxCount = 20)
param([string]$RSS_URL = "https://distrowatch.com/news/dwd.xml", [int]$MaxCount = 30)
try {
& "$PSScriptRoot/write-big.ps1" "OS Updates"
[xml]$Content = (invoke-webRequest -URI $RSS_URL).Content
"`t(by $($Content.rss.channel.title))"
" "
"Date OS Update"
"---- ---------"
[xml]$Content = (Invoke-WebRequest -URI $RSS_URL -userAgent "curl" -useBasicParsing).Content
[int]$Count = 0
foreach ($item in $Content.rss.channel.item) {
"`t$($item.title)"
"$($item.title)"
$Count++
if ($Count -eq $MaxCount) { break }
}
" (source: DistroWatch.com)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"