packer-plugin-windows-update icon indicating copy to clipboard operation
packer-plugin-windows-update copied to clipboard

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

Open simonlock opened this issue 2 years ago • 1 comments

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" { search_criteria = "IsInstalled=0" filters = [ "exclude:$_.Title -like 'Preview'", "include:$true", ] update_limit = 25 }

provisioner "windows-restart" { }

provisioner "windows-update" { search_criteria = "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...[0m azure-arm.test-acg: Uploading the Windows update check for reboot required elevated script...[0m azure-arm.test-acg: Uploading the Windows update script...[0m azure-arm.test-acg: Running Windows update...[0m azure-arm.test-acg: Searching for Windows updates...[0m 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)[0m azure-arm.test-acg: Found Windows update (2023-02-14; 40.79 MB): Windows Malicious Software Removal Tool x64 - v5.110 (KB890830)[0m 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)[0m azure-arm.test-acg: Downloading Windows updates (3 updates; 141.17 MB)...[0m azure-arm.test-acg: Installing Windows updates...[0m azure-arm.test-acg: Waiting for operation to complete (system performance: 3% cpu; 13% memory)...[0m azure-arm.test-acg: Waiting for operation to complete (system performance: 1% cpu; 15% memory)...[0m azure-arm.test-acg: Waiting for operation to complete (system performance: 3% cpu; 13% memory)...[0m azure-arm.test-acg: Restarting Machine[0m azure-arm.test-acg: Waiting for machine to restart...[0m azure-arm.test-acg: pkrvmxvtbbdxe98 restarted.[0m azure-arm.test-acg: Machine successfully restarted, moving on[0m azure-arm.test-acg: Uploading the Windows update elevated script...[0m azure-arm.test-acg: Uploading the Windows update check for reboot required elevated script...[0m azure-arm.test-acg: Uploading the Windows update script...[0m azure-arm.test-acg: Running Windows update...[0m azure-arm.test-acg: Searching for Windows updates...[0m 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)[0m azure-arm.test-acg: Downloading Windows updates (1 updates; 9.4 MB)...[0m azure-arm.test-acg: Installing Windows updates...[0m

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

simonlock avatar Mar 13 '23 16:03 simonlock

The problem also exists when using Packer 1.8.6

simonlock avatar Mar 14 '23 00:03 simonlock

We are facing same issue for our customers where updates are failing to download. Any solution for this?

garimakhulbe02 avatar Apr 28 '25 18:04 garimakhulbe02