mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-15 17:36:48 +02:00
Update list-os-updates.ps1
This commit is contained in:
parent
4f10d8d310
commit
aa1fd24f18
@ -1,8 +1,8 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Lists the latest operating system updates
|
Lists OS updates
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script lists the latest operating system update news.
|
This PowerShell script lists the latest updates for operating systems.
|
||||||
.PARAMETER RSS_URL
|
.PARAMETER RSS_URL
|
||||||
Specifies the URL to the RSS feed
|
Specifies the URL to the RSS feed
|
||||||
.PARAMETER MaxCount
|
.PARAMETER MaxCount
|
||||||
@ -15,19 +15,22 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
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 {
|
try {
|
||||||
& "$PSScriptRoot/write-big.ps1" "OS Updates"
|
" "
|
||||||
[xml]$Content = (invoke-webRequest -URI $RSS_URL).Content
|
"Date OS Update"
|
||||||
"`t(by $($Content.rss.channel.title))"
|
"---- ---------"
|
||||||
|
[xml]$Content = (Invoke-WebRequest -URI $RSS_URL -userAgent "curl" -useBasicParsing).Content
|
||||||
|
|
||||||
|
|
||||||
[int]$Count = 0
|
[int]$Count = 0
|
||||||
foreach ($item in $Content.rss.channel.item) {
|
foreach ($item in $Content.rss.channel.item) {
|
||||||
"`t→ $($item.title)"
|
"$($item.title)"
|
||||||
$Count++
|
$Count++
|
||||||
if ($Count -eq $MaxCount) { break }
|
if ($Count -eq $MaxCount) { break }
|
||||||
}
|
}
|
||||||
|
" (source: DistroWatch.com)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user