When the chef_client_updater script's scheduled task runs, but is unable to proceed due to a running version of Ruby.exe, the task will fail to be properly rescheduled.
It is necessary to call
$taskScheduler.Connect()
prior to trying to use the $taskScheduler object, otherwise it is not initialized.
Additionally, and likely unrevealed due to this issue, is what seems like a logic fault.
The reschedule logic sets the task to run x minutes from the last trigger time of the failed task. That may have the effect of scheduling the task to occur in the past. The task should be schedule to run xx minutes from current time.
Further, the task should likely be set to run as soon as possible if the trigger time is missed. (startWhenAvailable)
When the chef_client_updater script's scheduled task runs, but is unable to proceed due to a running version of Ruby.exe, the task will fail to be properly rescheduled.
It is necessary to call
$taskScheduler.Connect()
prior to trying to use the $taskScheduler object, otherwise it is not initialized.Additionally, and likely unrevealed due to this issue, is what seems like a logic fault. The reschedule logic sets the task to run x minutes from the last trigger time of the failed task. That may have the effect of scheduling the task to occur in the past. The task should be schedule to run xx minutes from current time.
Further, the task should likely be set to run as soon as possible if the trigger time is missed. (startWhenAvailable)