diff --git a/lib/ansible/modules/windows/win_updates.ps1 b/lib/ansible/modules/windows/win_updates.ps1 index af2a5d5792..8be45314b3 100644 --- a/lib/ansible/modules/windows/win_updates.ps1 +++ b/lib/ansible/modules/windows/win_updates.ps1 @@ -303,7 +303,7 @@ Function RunAsScheduledJob { Name = $job_name ArgumentList = $job_arg_list ErrorAction = "Stop" - ScheduledJobOption = @{ RunElevated=$True } + ScheduledJobOption = @{ RunElevated=$True; StartIfOnBatteries=$True; StopIfGoingOnBatteries=$False } } if($job_init) { $rsj_args.InitializationScript = $job_init } diff --git a/lib/ansible/modules/windows/win_updates.py b/lib/ansible/modules/windows/win_updates.py index 3b70cc06a8..72d98c7f7a 100644 --- a/lib/ansible/modules/windows/win_updates.py +++ b/lib/ansible/modules/windows/win_updates.py @@ -72,6 +72,9 @@ notes: - C(win_updates) does not manage reboots, but will signal when a reboot is required with the reboot_required return value. - C(win_updates) can take a significant amount of time to complete (hours, in some cases). Performance depends on many factors, including OS version, number of updates, system load, and update server load. +- C(win_updates) runs the module as a scheduled task, this task is set to start and continue to run even if the Windows host + swaps to battery power. This behaviour was changed from Ansible 2.4, before this the scheduled task would fail to start on + battery power. ''' EXAMPLES = r'''