Updated install-updates.ps1

This commit is contained in:
Markus Fleschutz 2024-12-04 11:30:18 +01:00
parent 7e774853fc
commit 36083d8eb3

View File

@ -3,10 +3,10 @@
Installs software updates Installs software updates
.DESCRIPTION .DESCRIPTION
This PowerShell script installs software updates for the local machine (might need admin rights). This PowerShell script installs software updates for the local machine (might need admin rights).
NOTE: Use the script 'list-updates.ps1' to list the latest software updates before. HINT: Use the script 'list-updates.ps1' to list the latest software updates in advance.
.EXAMPLE .EXAMPLE
PS> ./install-updates.ps1 PS> ./install-updates.ps1
(1/2) Checking requirements... (1/2) Checking update requirements...
Drive C: has 441 GB free (56% of 1TB used) Drive C: has 441 GB free (56% of 1TB used)
Swap space has 1GB free (2% of 1GB used) Swap space has 1GB free (2% of 1GB used)
No pending system reboot No pending system reboot
@ -23,7 +23,7 @@ try {
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) { if ($IsLinux) {
"⏳ (1/5) Checking requirements..." "⏳ (1/5) Checking update requirements..."
& "$PSScriptRoot/check-smart-devices.ps1" & "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-drive-space.ps1" / & "$PSScriptRoot/check-drive-space.ps1" /
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
@ -47,14 +47,14 @@ try {
Write-Progress -completed " " Write-Progress -completed " "
} else { } else {
# Windows: # Windows:
"⏳ (1/2) Checking requirements..." "⏳ (1/2) Checking update requirements..."
& "$PSScriptRoot/check-smart-devices.ps1" & "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-drive-space.ps1" C & "$PSScriptRoot/check-drive-space.ps1" C
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
& "$PSScriptRoot/check-pending-reboot.ps1" & "$PSScriptRoot/check-pending-reboot.ps1"
Start-Sleep -seconds 3 Start-Sleep -seconds 3
"" ""
"⏳ (2/2) Installing updates from winget and Microsoft Store..." "⏳ (2/2) Installing updates from winget..."
"" ""
& winget upgrade --all --source=winget & winget upgrade --all --source=winget
# & winget upgrade --all --source=msstore # does not work # & winget upgrade --all --source=msstore # does not work