问题描述:

I am creating a scheduled task in powershell. I want the trigger to be every 15 minutest to the hour and 15 minutes past the hour.

Fx:

00:15

00:45

01:15

01:45

..

23:15

23:45

How do I accomplish this with a New-ScheduledTaskTrigger?

网友答案:

Ok,

You need to define it to have a RepetitionInterval and RepetitionDuration to get it to repeat.

I was unable to figure out how to set an Indefinite duration for the repeat, but I got it to repeat until 2036 by doing:

$span = New-TimeSpan -End "2036-01-01"
$trigger = New-ScheduledTaskTrigger -Once -At 00:15 -RepetitionInterval 00:30 -RepetitionDuration $span

And then registering the task.

相关阅读:
Top