Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
xScheduledTask ExecutionTimeLimit = '00:00:00' sets ExecutionTimeLimit to 3 days #115
Details of the scenario you tried and the problem that is occurring:
The DSC configuration that is using the resource (as detailed as possible):
Version of the Operating System and PowerShell the DSC Target Node is running:
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Hi @ahebert - I've tried this on Windows Server 2016 and can confirm you are correct. Setting an execution time limit of '00:00:00' will set the time to 3 days. Not setting the parameter at all results in an execution time limit of 8 hours (the default value for the parameter when not set).
This actually has a really simple fix:
if ($ExecutionTimeLimit -gt [System.TimeSpan] '00:00:00')
I have confirmed that this change will resolve the issue. I'll need to create some tests for this (which is actually the largest part of the change). So I'll get this done tomorrow night (running out of time tonight).
While making this change I found that the behaviour of ExecutionTimeLimit is different on Windows Server 2012 R2 and Windows Server 2016:
On Windows Server 2012 R2:
$settings = New-ScheduledTaskSettingsSet $settings.ExecutionTimeLimit = 'PT0S'
On Windows Server 2016:
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit '00:00:00'
So this took a bit longer than expected - but hopefully if anyone else is looking into this issue they'll find this info.