[Windows] Update helper function that returns Windows Update states (#8878)

This commit is contained in:
Vasilii Polikarpov
2023-11-27 12:29:42 +01:00
committed by GitHub
parent 12066050d0
commit e1e621e78c
5 changed files with 49 additions and 29 deletions

View File

@@ -4,9 +4,9 @@
################################################################################
Invoke-SBWithRetry -RetryCount 10 -RetryIntervalSeconds 120 -Command {
$inProgress = Get-WindowsUpdatesHistory | Where-Object Status -eq "InProgress" | Where-Object Title -notmatch "Microsoft Defender Antivirus"
$inProgress = Get-WindowsUpdateStates | Where-Object State -eq "Running" | Where-Object Title -notmatch "Microsoft Defender Antivirus"
if ( $inProgress ) {
$title = $inProgress.Title -join "`n"
throw "InProgress: $title"
throw "Windows updates are still installing: $title"
}
}