We are having the same error trying to install this same Cumulative Update using Azure Image Builder:
We get to the update-windows portion of the Custom Image Template, and it just churns and churns. It will finally timeout and then reboots. After the reboot, Azure Image Builder starts to throw errors and then will abort the image creation process.
2024/07/15 21:47:34 ui: azure-arm: Searching for Windows updates...
2024/07/15 21:47:34 ui: azure-arm: Found Windows update (2024-03-27; 18.08 MB): Update for Windows Security platform antimalware platform - KB5007651 (Version 1.0.2402.27001)
2024/07/15 21:47:34 ui: azure-arm: Found Windows update (2024-07-09; 69.75 MB): Windows Malicious Software Removal Tool x64 - v5.126 (KB890830)
2024/07/15 21:47:34 ui: azure-arm: Found Windows update (2024-07-09; 71.55 MB): 2024-07 Cumulative Update for .NET Framework 3.5 and 4.8.1 for Windows 11, version 22H2 for x64 (KB5039895)
2024/07/15 21:47:34 ui: azure-arm: Found Windows update (2024-07-15; 12.77 MB): Update for Microsoft Defender Antivirus antimalware platform - KB4052623 (Version 4.18.24060.7) - Current Channel (Broad)
2024/07/15 21:47:34 ui: azure-arm: Found Windows update (2024-07-15; 1181.98 MB): Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.415.113.0) - Current Channel (Broad)
2024/07/15 21:47:34 ui: azure-arm: Found Windows update (2024-07-09; 131038.93 MB): 2024-07 Cumulative Update for Windows 11 Version 22H2 for x64-based Systems (KB5040442)
packer-plugin-windows-update plugin: 2024/07/15 22:07:24 [INFO] RPC client: Communicator ended with: 1
2024/07/15 22:07:24 ui: azure-arm: ERROR: You cannot call a method on a null-valued expression.
2024/07/15 22:07:24 ui: azure-arm: ERROR: at <ScriptBlock>, C:\Windows\Temp\packer-windows-update.ps1: line 190
2024/07/15 22:07:24 ui: azure-arm: ERROR: at <ScriptBlock>, <No file>: line 1
2024/07/15 22:07:24 ui: azure-arm: ERROR EXCEPTION: System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
2024/07/15 22:07:24 ui: azure-arm: ERROR EXCEPTION: at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2024/07/15 22:07:24 ui: azure-arm: ERROR EXCEPTION: at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2024/07/15 22:07:24 ui: azure-arm: ERROR EXCEPTION: at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2024/07/15 22:07:24 ui: azure-arm: ERROR EXCEPTION: at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2024/07/15 22:07:24 ui: azure-arm: ERROR EXCEPTION: at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2024/07/15 22:07:24 ui: azure-arm: ERROR EXCEPTION: at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2024/07/15 22:07:24 packer-plugin-windows-update plugin: 2024/07/15 22:07:24 Retryable error: Windows update script exited with non-zero exit status: 1