Change the Schedule of a Clustered Scheduled Task

By Greg No comments

In a previous post, I showed how you can create a clustered scheduled task. Now we could use that trick to change the schedule of a scheduled task by deleting and then importing a new one, but wouldn’t it be better to just change the schedule? Using PowerShell, this is quite simple.

First, connect to one of the servers that are part of the cluster. Next, we need to create the new trigger using New-ScheduledTaskTrigger:

$trigger = New-ScheduledTaskTrigger -At 9:00AM -Weekly -WeeksInterval 1 -DaysOfWeek Monday,tuesday,Wednesday,Thursday,Friday

This will create a trigger that runs every weekday at 9:00AM. Use other parameters to sort out when your trigger needs to run.

Finally, we need to set the trigger on our clustered scheduled task. Again, this is an easy command. All we need is the task name and our trigger:

Set-ClusteredScheduledTask -TaskName "MyTaskName" -Trigger $trigger

That’s it! Our clustered scheduled task is now updated on every instance of the cluster, ready to trigger on the new schedule and ready for failover.

Leave a Reply