Update list-updates.ps1 and install-updates.ps1

This commit is contained in:
Markus Fleschutz 2023-09-18 08:21:30 +02:00
parent 48caeda15f
commit 77f9dafecf
2 changed files with 12 additions and 12 deletions

View File

@ -1,9 +1,9 @@
<#
.SYNOPSIS
Installs updates
Installs software updates
.DESCRIPTION
This PowerShell script installs software updates for the local machine (needs admin rights).
Use the script 'list-updates.ps1' to list available updates.
NOTE: Use the script 'list-updates.ps1' to list the latest software updates.
.EXAMPLE
PS> ./install-updates.ps1
.LINK
@ -32,12 +32,12 @@ try {
& sudo softwareupdate -i -a
Write-Progress -completed " "
} else {
Write-Progress "⏳ Installing updates..."
& winget upgrade --all
Write-Progress "⏳ Installing updates from winget and Microsoft Store..."
& winget upgrade --all --include-unknown
Write-Progress -completed " "
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"Updates installed in $Elapsed sec"
"Installed updates in $Elapsed sec"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,9 +1,9 @@
<#
.SYNOPSIS
Lists new software updates
Lists software updates
.DESCRIPTION
This PowerShell script queries and lists available software updates for the local machine.
Use 'install-updates.ps1' to install the listed updates.
This PowerShell script queries the latest available software updates for the local machine and lists it.
NOTE: Use the script 'install-updates.ps1' to install the listed updates.
.EXAMPLE
PS> ./list-updates.ps1
@ -25,12 +25,12 @@ try {
"⏳ (2/2) Querying Snap updates..."
& sudo snap refresh --list
} else {
Write-Progress "⏳ Querying the latest updates from winget and Microsoft Store..."
" "
Write-Progress "⏳ Querying new software updates..."
& winget upgrade
Write-Progress -completed "."
& winget upgrade --include-unknown
Write-Progress -completed " "
}
"(use 'install-updates.ps1' to install the listed updates)"
" (use 'install-updates.ps1' to install the listed updates)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"