From f77735e7414e17abd8ebaccb591f71117cc01361 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sun, 16 Apr 2023 10:29:17 +0200 Subject: [PATCH] Add list-updates.ps1 --- Scripts/list-updates.ps1 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Scripts/list-updates.ps1 diff --git a/Scripts/list-updates.ps1 b/Scripts/list-updates.ps1 new file mode 100644 index 00000000..45347b0f --- /dev/null +++ b/Scripts/list-updates.ps1 @@ -0,0 +1,28 @@ +<# +.SYNOPSIS + Lists software updates +.DESCRIPTION + This PowerShell script lists available updates for the local machine. +.EXAMPLE + PS> ./list-updates +.LINK + https://github.com/fleschutz/PowerShell +.NOTES + Author: Markus Fleschutz | License: CC0 +#> + +try { + if ($IsLinux) { + "⏳ (1/4) Querying updates for installed Debian packages..." + & sudo apt update + } else { + Write-Progress "⏳ Querying available updates..." + " " + & winget upgrade + Write-Progress -Completed " " + } + exit 0 # success +} catch { + "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +} \ No newline at end of file