forked from fleschutz/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list-os-updates.ps1
executable file
·38 lines (34 loc) · 879 Bytes
/
list-os-updates.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<#
.SYNOPSIS
Lists OS updates
.DESCRIPTION
This PowerShell script lists the latest updates for operating systems.
.PARAMETER RSS_URL
Specifies the URL to the RSS feed
.PARAMETER MaxCount
Specifies the number of news to list
.EXAMPLE
PS> ./list-os-updates
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$RSS_URL = "https://distrowatch.com/news/dwd.xml", [int]$MaxCount = 30)
try {
" "
"Date OS Update"
"---- ---------"
[xml]$Content = (Invoke-WebRequest -URI $RSS_URL -userAgent "curl" -useBasicParsing).Content
[int]$Count = 0
foreach ($item in $Content.rss.channel.item) {
"$($item.title)"
$Count++
if ($Count -eq $MaxCount) { break }
}
" (source: DistroWatch.com)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}