rgl / packer-plugin-windows-update

Packer plugin for installing Windows updates
Mozilla Public License 2.0
299 stars 71 forks source link

Packer in Azure only applies the first update found (win-10 and win-11) #125

Open simonlock opened 1 year ago

simonlock commented 1 year ago

Packer in Azure using packer 1.8.5:

image offer: windows-10 publisher: MicrosoftWindowsDesktop image sku: win10-22h2-avd-g2

and

image offer: windows-11 publisher: MicrosoftWindowsDesktop image sku: win11-22h2-avd-g2

I've found that instructing a restart provisioner and also a second (or even third) windows update provisioner finds additional updates but still fails to install them. The addon is no longer handling reboots or continues correctly, it seems. and is only installing the very first update found. I've also tried the updated plugin @ version "0.14.2" but the problem is the same.

As described above I've tried the following:

provisioner "windows-update" { searchcriteria = "IsInstalled=0" filters = [ "exclude:$.Title -like 'Preview'", "include:$true", ] update_limit = 25 }

provisioner "windows-restart" { }

provisioner "windows-update" { searchcriteria = "IsInstalled=0" filters = [ "exclude:$.Title -like 'Preview'", "include:$true", ] update_limit = 25 }

In the following output, only KB5012170 gets installed properly. Furthermore, not all available updates are found.

azure-arm.test-acg: Uploading the Windows update elevated script... azure-arm.test-acg: Uploading the Windows update check for reboot required elevated script... azure-arm.test-acg: Uploading the Windows update script... azure-arm.test-acg: Running Windows update... azure-arm.test-acg: Searching for Windows updates... azure-arm.test-acg: Found Windows update (2022-11-10; 0.04 MB): 2022-08 Security Update for Windows 11 22H2 for x64-based Systems (KB5012170) azure-arm.test-acg: Found Windows update (2023-02-14; 40.79 MB): Windows Malicious Software Removal Tool x64 - v5.110 (KB890830) azure-arm.test-acg: Found Windows update (2023-03-13; 100.34 MB): Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.383.1708.0) azure-arm.test-acg: Downloading Windows updates (3 updates; 141.17 MB)... azure-arm.test-acg: Installing Windows updates... azure-arm.test-acg: Waiting for operation to complete (system performance: 3% cpu; 13% memory)... azure-arm.test-acg: Waiting for operation to complete (system performance: 1% cpu; 15% memory)... azure-arm.test-acg: Waiting for operation to complete (system performance: 3% cpu; 13% memory)... azure-arm.test-acg: Restarting Machine azure-arm.test-acg: Waiting for machine to restart... azure-arm.test-acg: pkrvmxvtbbdxe98 restarted. azure-arm.test-acg: Machine successfully restarted, moving on azure-arm.test-acg: Uploading the Windows update elevated script... azure-arm.test-acg: Uploading the Windows update check for reboot required elevated script... azure-arm.test-acg: Uploading the Windows update script... azure-arm.test-acg: Running Windows update... azure-arm.test-acg: Searching for Windows updates... azure-arm.test-acg: Found Windows update (2023-02-14; 9.4 MB): Update for Microsoft Defender Antivirus antimalware platform - KB4052623 (Version 4.18.2301.6) azure-arm.test-acg: Downloading Windows updates (1 updates; 9.4 MB)... azure-arm.test-acg: Installing Windows updates...

Any help or suggestions in fixing this would be really appreciated.

simonlock commented 1 year ago

The problem also exists when using Packer 1.8.6