Updated list-updates.ps1

This commit is contained in:
Markus Fleschutz 2025-04-15 13:34:41 +02:00
parent a343594ab0
commit 9e9c94ea71

View File

@ -3,8 +3,7 @@
Lists software updates Lists software updates
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the latest available software updates for the This PowerShell script queries the latest available software updates for the
local machine and lists it. local machine and lists it (for installation use 'install-updates.ps1').
NOTE: Execute 'install-updates.ps1' to install the listed updates.
.EXAMPLE .EXAMPLE
PS> ./list-updates.ps1 PS> ./list-updates.ps1
Querying Microsoft Store updates... Querying Microsoft Store updates...
@ -21,25 +20,36 @@
try { try {
if ($IsLinux) { if ($IsLinux) {
"⏳ (1/2) Querying package updates..." if (Get-Command apt -ErrorAction SilentlyContinue) {
Write-Host "`n⏳ Querying APT package updates..." -foregroundColor green
& sudo apt update & sudo apt update
& sudo apt list --upgradable & sudo apt list --upgradable
"⏳ (2/2) Querying Snap updates..." }
if (Get-Command snap -ErrorAction SilentlyContinue) {
Write-Host "`n⏳ Querying Snap updates..." -foregroundColor green
& sudo snap refresh --list & sudo snap refresh --list
}
} elseif ($IsMacOS) { } elseif ($IsMacOS) {
throw "Sorry, MacOS not supported yet" if (Get-Command brew -ErrorAction SilentlyContinue) {
Write-Host "`n⏳ Querying Homebrew updates..." -foregroundColor green
& brew outdated
}
} else { } else {
if (Get-Command winget -ErrorAction SilentlyContinue) { if (Get-Command winget -ErrorAction SilentlyContinue) {
Write-Host "`n⏳ Querying Microsoft Store updates..." -foregroundColor green Write-Host "`n⏳ Querying Microsoft Store updates..." -foregroundColor green
& winget upgrade --include-unknown --source=msstore & winget upgrade --include-unknown --source=msstore
Write-Host "`n⏳ Querying WinGet Store updates..." -foregroundColor green Write-Host "`n⏳ Querying WinGet updates..." -foregroundColor green
& winget upgrade --include-unknown --source=winget & winget upgrade --include-unknown --source=winget
} }
if (Get-Command choco -ErrorAction SilentlyContinue) { if (Get-Command choco -ErrorAction SilentlyContinue) {
Write-Host "`n⏳ Querying Chocolatey updates..." -foregroundColor green Write-Host "`n⏳ Querying Chocolatey updates..." -foregroundColor green
& choco outdated & choco outdated
} }
if (Get-Command scoop -ErrorAction SilentlyContinue) {
Write-Host "`n⏳ Querying Scoop updates..." -foregroundColor green
& scoop status
}
} }
" " " "
"💡 Execute 'install-updates.ps1' to install the listed updates." "💡 Execute 'install-updates.ps1' to install the listed updates."