Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[windows] Update Get-WindowsUpdateStates function #11397

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions images/windows/scripts/helpers/InstallHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,15 @@ function Get-WindowsUpdateStates {
19 {
$state = "Installed"
$title = $event.Properties[0].Value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$completedUpdates[$title] = ""
$completedUpdates[$title] = $state
break
}
20 {
$state = "Failed"
$title = $event.Properties[1].Value
$completedUpdates[$title] = ""
if (-not $completedUpdates.ContainsKey($title)) {
$completedUpdates[$title] = $state
}
break
}
43 {
Expand All @@ -454,8 +456,13 @@ function Get-WindowsUpdateStates {
}
}

# Skip update started event if it was already completed
if ( $state -eq "Running" -and $completedUpdates.ContainsKey($title) ) {
# Skip Running update event if it was already completed
if ( ($state -eq "Running") -and $completedUpdates.ContainsKey($title) ) {
continue
}

# Skip Failed update event if it was already successfully installed
if ( ($state -eq "Failed") -and $completedUpdates[$title] -eq "Installed" ) {
continue
}

Expand Down
Loading