-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Question] How to specify day to run scheduled task? #59
Comments
Hi Zuldan, Let's try set ScheduledAt as past date for Saturday AM2:00:00, like Code looks like this. configuration Sample
{
Import-DscResource -ModuleName GraniResource;
cScheduleTask 1WeekSample
{
Ensure = "Present"
TaskName = "Sample"
TaskPath = "\"
ScheduledAt = [DateTime]"2016/02/13 02:00:00" # Means Saturday
RepetitionIntervalTimeSpanString = [TimeSpan]::FromDays(7).ToString() # run every week
RepetitionDurationTimeSpanString = [TimeSpan]::MaxValue.ToString() # forever
Execute = "powershell.exe"
Argument = "-Command Get-Date"
Disable = $true
Hidden = $true
Compatibility = "Win8"
Runlevel = "Highest"
}
} Is it answer your question? |
Hi guitarrapc, I will play around with the code tomorrow and see how I go. Thank you for the fast response! |
Hi guitarrapc, After investigating it appears the resource is not creating a true 'Weekly' trigger. It's creating a 'One time'. Maybe you could add this functionality like so... configuration Sample We're using this resource on 200+ servers and we need to change a current scheduled task from daily or weekly. I'm worried when admin's view the task settings and see "Run once" they might get confused. On another note, have you considered contributing this resource to Microsoft? it's the best ScheduledTask DSC resource on the Internet and you already have all the Pester tests for it so I'm sure Microsoft would gladly accept it. Your code is beautiful! |
Hi guittarpc, any chance of adding Day = to the options ? |
Hi guitarrapc, any tips on how to configure a scheduled task to run for example every Saturday at 2AM?
I can't figure out how to specify what day to run the scheduled task on.
The text was updated successfully, but these errors were encountered: