2021-12-02 10:56:43 +03:00
|
|
|
################################################################################
|
|
|
|
|
## File: Wait-WindowsUpdatesForInstall.ps1
|
|
|
|
|
## Desc: Wait for installation windows updates to complete
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
Invoke-SBWithRetry -RetryCount 10 -RetryIntervalSeconds 120 -Command {
|
2022-09-19 17:44:38 +02:00
|
|
|
$inProgress = Get-WindowsUpdatesHistory | Where-Object Status -eq "InProgress" | Where-Object Title -notmatch "Microsoft Defender Antivirus"
|
2021-12-02 10:56:43 +03:00
|
|
|
if ( $inProgress ) {
|
|
|
|
|
$title = $inProgress.Title -join "`n"
|
|
|
|
|
throw "InProgress: $title"
|
|
|
|
|
}
|
|
|
|
|
}
|