Skip to content

Windows Update Offload: "Fetch Windows Updates" task is killed after 72h and never restarts until reboot #887

Open

Description

@fbassas

Description

When Windows Update Offload is enabled (Enable-IcingaWindowsUpdateOffload), the scheduled task
\Icinga\Icinga for Windows\Fetch Windows Updates is registered without an explicit
ExecutionTimeLimit, so Windows applies its default limit of 72 hours.

jobs\FetchWindowsUpdates.ps1 is designed to run forever (endless loop that refreshes the cache
every 10 minutes). After 72 hours the Task Scheduler terminates the process, and since the task
only has an At startup trigger, it is never started again until the next reboot.

From then on the cache file is no longer refreshed and Invoke-IcingaCheckUpdates goes
WARNING/CRITICAL on every host, e.g.:

Last Update Check: Value 5.98h is greater than threshold 30m

In our environment this happened on all Windows hosts at the same time.

Steps to reproduce

  1. Run Enable-IcingaWindowsUpdateOffload
  2. Wait more than 72 hours without rebooting the host
  3. The task is in state Ready (not Running) and the Last Update Check of
    Invoke-IcingaCheckUpdates exceeds the 20m/30m thresholds

Evidence

PS> $t = Get-ScheduledTask -TaskName 'Fetch Windows Updates' -TaskPath '\Icinga\Icinga for Windows\'
PS> $t.Settings.ExecutionTimeLimit
PT72H
PS> $t.Triggers | Select-Object CimClass
Root/Microsoft/Windows/TaskScheduler:MSFT_TaskBootTrigger

Starting the task manually (Start-ScheduledTask) fixes the check until the next 72h limit is hit.

Cause

In lib/provider/updates/Register-IcingaWindowsScheduledTaskWindowsUpdates.psm1:

$TaskSettings = New-ScheduledTaskSettingsSet -DontStopIfGoingOnBatteries -AllowStartIfOnBatteries -StartWhenAvailable;

No -ExecutionTimeLimit is passed, so the Windows default (PT72H) is used, and the only trigger is
New-ScheduledTaskTrigger -AtStartup.

Suggested fix

Disable the execution time limit and add a recurring trigger, so the job is restarted if it ever
stops for any reason (IgnoreNew prevents parallel instances while it is running):

$TaskSettings = New-ScheduledTaskSettingsSet -DontStopIfGoingOnBatteries -AllowStartIfOnBatteries -StartWhenAvailable `
    -ExecutionTimeLimit (New-TimeSpan -Seconds 0) -MultipleInstances IgnoreNew;

$TaskTrigger = @(
    (New-ScheduledTaskTrigger -AtStartup),
    (New-ScheduledTaskTrigger -Once -At (Get-Date).Date -RepetitionInterval (New-TimeSpan -Minutes 30) -RepetitionDuration (New-TimeSpan -Days 3650))
);

Workaround

Patch the existing task (we enforce this via Puppet):

$t = Get-ScheduledTask -TaskName 'Fetch Windows Updates' -TaskPath '\Icinga\Icinga for Windows\'
Set-ScheduledTask -TaskName $t.TaskName -TaskPath $t.TaskPath `
    -Settings (New-ScheduledTaskSettingsSet -DontStopIfGoingOnBatteries -AllowStartIfOnBatteries -StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Seconds 0) -MultipleInstances IgnoreNew) `
    -Trigger @((New-ScheduledTaskTrigger -AtStartup), (New-ScheduledTaskTrigger -Once -At (Get-Date).Date -RepetitionInterval (New-TimeSpan -Minutes 30) -RepetitionDuration (New-TimeSpan -Days 3650)))
Start-ScheduledTask -TaskName $t.TaskName -TaskPath $t.TaskPath

Environment

  • Icinga PowerShell Framework: 1.16.0
  • Icinga PowerShell Plugins: 1.16.1
  • Icinga 2 agent: 2.14.10
  • OS: [p. ex. Windows Server 2022]
  • Icinga 2 service user: NT AUTHORITY\NetworkService (reason for using the offload feature)

Activity

  1. self-assigned this
    on Oct 28, 2026
  2. added
    Bug
    Investigation
    on Oct 28, 2026
  3. added this to the v1.16.1 milestone on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugInvestigation

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions