From 1cdd09c3e2865f13a9eb9d0c5b4185d8ea270bec Mon Sep 17 00:00:00 2001 From: "Jeff Weiner (OFFICE)" Date: Mon, 30 Dec 2024 15:41:02 -0800 Subject: [PATCH] Update WU state checking logic to allow a failure if it is followed by success --- images/windows/scripts/helpers/InstallHelpers.ps1 | 1 + images/windows/scripts/tests/WindowsFeatures.Tests.ps1 | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index 67faade1d2a5..5d6f2b6f023a 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -462,6 +462,7 @@ function Get-WindowsUpdateStates { [PSCustomObject]@{ State = $state Title = $title + TimeCreated = $event.TimeCreated } } } diff --git a/images/windows/scripts/tests/WindowsFeatures.Tests.ps1 b/images/windows/scripts/tests/WindowsFeatures.Tests.ps1 index 03b56a2108d1..b9f5e6096910 100644 --- a/images/windows/scripts/tests/WindowsFeatures.Tests.ps1 +++ b/images/windows/scripts/tests/WindowsFeatures.Tests.ps1 @@ -66,10 +66,10 @@ Describe "Windows Updates" { "$env:windir\WindowsUpdateDone.txt" | Should -Exist } - $testCases = Get-WindowsUpdateStates | Sort-Object Title | ForEach-Object { + $testCases = Get-WindowsUpdateStates | Sort-Object TimeCreated | Group-Object Title | ForEach-Object { @{ - Title = $_.Title - State = $_.State + Title = $_.Group[-1].Title + State = $_.Group[-1].State } }