PSWindowsUpdate icon indicating copy to clipboard operation
PSWindowsUpdate copied to clipboard

Object reference not set to an instance of an object.

Open jbne opened this issue 1 year ago • 10 comments

I'm getting this error when trying to perform a Windows update using Packer to build a win11-23h2-ent VM in Azure:

2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1: Install-WindowsUpdate : Something goes wrong: Update for Windows Security platform antimalware platform - KB5007651
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1: (Version 1.0.2402.27001); Object reference not set to an instance of an object.
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1: At C:\Windows\Temp\script-668de296-dc4e-939c-b1ea-098a3fa74e58.ps1:18 char:1
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1: + Install-WindowsUpdate -AcceptAll -AutoReboot
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1:     + CategoryInfo          : CloseError: (:) [Get-WindowsUpdate], Exception
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1:     + FullyQualifiedErrorId : Debug,PSWindowsUpdate.GetWindowsUpdate
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1:
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]
2024-07-09T18:24:25-07:00: ==> azure-arm.autogenerated_1: Step "StepProvision" failed

This is a similar error to the packer-plugin-windows-update described in this issue that I recently opened, so maybe they are somewhat related - something that was never expected to be null is now null maybe?

https://github.com/rgl/packer-plugin-windows-update/issues/144

jbne avatar Jul 10 '24 17:07 jbne

I'm suddenly seeing this same error on a wide range of machines.

callworthp avatar Jul 11 '24 15:07 callworthp

This issue is most likely caused by KB5040442, similar to the one I posted in the packer-plugin-windows-update issue. A workaround is to use a previous Windows version that does not include that update and/or exclude installing KB5040442 for now until there's a fix for it from Microsoft.

jbne avatar Jul 11 '24 15:07 jbne

I'm suddenly seeing this same error on a wide range of machines.

same issue for me...

plao avatar Jul 18 '24 14:07 plao

It's on multiple machines with multiple updates. It's not just one problematic update from Microsoft.

callworthp avatar Jul 18 '24 17:07 callworthp

Have a look here, I suppose, it's related...

https://learn.microsoft.com/en-us/windows/release-health/status-windows-11-23H2#the-june-2024-preview-update-might-impact-applications-using-windows-update-apis

plao avatar Jul 18 '24 19:07 plao

It happens with all users I tried. system account, Administrator accounts ,normal account. Same error message as above.

HoffmannTom avatar Jul 19 '24 19:07 HoffmannTom

Updating PSWindowsUpdate to version 2.2.1.5 resolved the issue for me.

callworthp avatar Jul 22 '24 20:07 callworthp

Updating PSWindowsUpdate to version 2.2.1.5 resolved the issue for me.

Thanks a lot! I will try also and I will give here feedback!

plao avatar Jul 22 '24 20:07 plao

Updating PSWindowsUpdate to version 2.2.1.5 resolved the issue for me.

Seems to working, yes! Thanks a lot again ;-)

plao avatar Jul 22 '24 22:07 plao

Thanks, that also worked for me! :)

gen2k1 avatar Jul 27 '24 08:07 gen2k1