From 61af2907249103f223d00960f0237476480333be Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 18 Aug 2024 12:20:21 +0200 Subject: [PATCH] Improve log messages of updates --- scripts/Windows/Scripts/Update.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/Scripts/Update.ps1 b/scripts/Windows/Scripts/Update.ps1 index c725a6eb..b1c2d464 100644 --- a/scripts/Windows/Scripts/Update.ps1 +++ b/scripts/Windows/Scripts/Update.ps1 @@ -7,12 +7,14 @@ function Update-WindowsInstallation { Runs the Windows update loop. #> function Start-UpdateLoop { - Write-Host "Preparing for Windows Update"; $null = Import-Module PSWindowsUpdate; + $hasUpdates = $false; + Write-Host "Searching for updates…"; while (((Get-WindowsUpdate -IgnoreReboot).Count -gt 0)) { Write-Host "There are updates available."; Write-Host "Installing updates"; + $hasUpdates = $true; try { $null = Install-WindowsUpdate -AcceptAll -IgnoreReboot -ErrorAction "SilentlyContinue"; @@ -28,6 +30,10 @@ function Update-WindowsInstallation { return; } } + + if (-not $hasUpdates) { + Write-Host "There are no updates available."; + } } Start-UpdateLoop;