From 86d85660f06c212c26276907782473ec3a071a6b Mon Sep 17 00:00:00 2001 From: Tim Wright Date: Wed, 15 Jan 2025 20:31:36 +0000 Subject: [PATCH] better updates --- vhdbuilder/packer/configure-windows-vhd.ps1 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vhdbuilder/packer/configure-windows-vhd.ps1 b/vhdbuilder/packer/configure-windows-vhd.ps1 index 005cce316e3..186219c940f 100644 --- a/vhdbuilder/packer/configure-windows-vhd.ps1 +++ b/vhdbuilder/packer/configure-windows-vhd.ps1 @@ -387,9 +387,23 @@ function Install-ContainerD { } function Reapply-Long-Term-Update { + Write-Log "Reapplying Long Term Updates" Install-Module -Name PSWindowsUpdate -Force -Scope CurrentUser Import-Module PSWindowsUpdate - Get-WindowsUpdate | Where-Object {$_.Title -match "Cumulative Update"} | Install-WindowsUpdate -AcceptAll -AutoReboo + + # Get any cumulative updates that need to be applied. + $updates = Get-WindowsUpdate + + # Print the table of updates that will be applied for debugging + Write-Log "List of all updates available" + echo $updates + + $updatesToApply = echo $updates | Where-Object {$_.Title -match "Cumulative Update"} + Write-Log "List of all updates to apply" + echo $updatesToApply + + # Now apply them. + echo $updatesToApply | Install-WindowsUpdate -AcceptAll } function Install-OpenSSH {