Monthly Clustered Scheduled Task - Trigger

Hi Everyone,

I am looking for some help in scripting the Monthly trigger for Clustered Scheduled task, this has to be configured through Powershell and GUI does not work. For Clustered Scheduled task it has only daily and Weekly but not direct Monthly trigger, need to have a workaround to have this done.

Below is the 'Powershell commands' I am trying to schedule the task to run 1st of every month

$Trigger = New-ScheduledTaskTrigger -At 05:00AM -daliy
if ((Get-Date).day -eq 01) { $action= New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument "E:\SCRIPTS\TaskScheduler\Test123.ps1" } 
Register-ClusteredScheduledTask Cluster "Taskserver01.contoso.com" TaskType AnyNode Action $action Trigger $trigger TaskName Test123



You can use the following trigger to get close to a month or Schtasks.exe for a more accurate monthly task.

New-ScheduledTaskTrigger -Daily -DaysInterval 30 -At 5am

Thanks for the reply. As you said it is close to a month, not sure we can use Schtasks.exe for Clustered Scheduled Task

Just thinking out loud here, not able to test. Have you tried creating a task using the monthly trigger, export that to XML, then try importing that using the -Xml option to Register-ClusteredScheduledTask ??

I have also tried the XML import, for regular Scheduled task it is working but not for the Clustered Scheduled task. Finally found a workaround. I have applied the ‘if’ condition in the script from the action trigger and its working.