-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xScheduledTask: daily triggers fall out of compliance each day #148
Comments
Hi FinickyCode, I've got the same issue. It looks like it takes StartTime ('23:30:00') and converts to the time of the current date, but when you apply your configuration, it compares the time with the time when the scheduled task was created. See my configuration and output when I apply the configuration next day:
As a workaround, I specified exact date and time which helped: It is an interesting question how the issue will be solved by Powershell Team. |
Hi @FinickyCode and @VitaliHarbiankou - thanks for logging this and all the detailed info. I'm going to try and get some time this weekend (it's a long weekend here) to put into cleaning up some of these issues in xScheduledTask. Thanks for your patience on this one. |
@VitaliHarbiankou you are right on the money, I can't believe I didn't think of that, thank you. I can't imagine that not solving my issue. I've updated all my configurations to have a StartTime with a fixed date and will see how it goes. In terms of helping future users that might encounter this, can I suggest the following:
I think those two things will address the issue as I see it: the default value will be a fixed date in the past, and if someone specifies just a time for StartTime, it will default to a fixed date in the past also. This still allows setting a fixed date in the future (which I guess someone may want), and in that scenario, it will also work in a manner that I'd consider desirable. Any downsides or things I've missed? @PlagueHO I'm happy to do a pull request if this is a reasonable approach. |
See also Issue #251. |
It seems that scheduled tasks with a daily schedule get deleted and recreated every day, on the first DSC run after midnight. It appears to me that the date in the daily trigger is compared to the current date.
You can reproduce this by creating a task with a daily trigger, then manually change the date in the daily trigger, and Test-DscConfiguration will return False, setting the date back to the current date will result in Test-DscConfiguration returning True.
Is this expected? Seems to me that the date on the daily trigger should not matter if it is the current date or earlier.
Configuration:
Windows version: Server 2016, 10.0.14393.0
PowerShell version:
DSC module version: 4.0.0.0
The text was updated successfully, but these errors were encountered: