dsccommunity / ComputerManagementDsc

DSC resources for for configuration of a Windows computer. These DSC resources allow you to perform computer management tasks, such as renaming the computer, joining a domain and scheduling tasks as well as configuring items such as virtual memory, event logs, time zones and power settings.
https://dsccommunity.org
MIT License
300 stars 83 forks source link

ScheduledTask: Delay parameter applicability #345

Open SDedik opened 4 years ago

SDedik commented 4 years ago

Details of the scenario you tried and the problem that is occurring

According to documentation:

Delay | Write | String | Specifies a delay to the start of the trigger. The delay is a static delay before the task is executed. Can only be used in combination with ScheduleType OnEvent.

Is there a specific reason why Delay is only applicable to OnEvent ScheduleType? Because while creating task in GUI, this parameter is applicable to every ScheduleType except OnIdle (where it is disabled, for obvious reasons) and On a schedule (where it is replaced by RandomDelay)

In my experience creating tasks with ScheduleType = AtStartup and AtLogon is a very common scenario, but setting delay for such tasks is currently not supported by the dsc resource.

Suggested solution to the issue

Delay parameter has to be applicable to ScheduleTypes AtStartup, AtLogon and other types to match behavior of GUI Task Scheduler editor.

PlagueHO commented 3 years ago

Hi @SDedik - sorry about the delay in looking at this. I've unfortunately not had time to keep on top of these.

It is possible the reason this wasn't implemented was earlier versions of the PowerShell cmdlets/objects may not have supported it.

But if it supported by the cmdlets then we can implement it - just need a PR. I will try and get to it if no one else does.