# Monthly Clustered Scheduled Task - Trigger

**URL:** <https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754>\
**Category:** PowerShell Help\
**Created:** [August 4, 2020, 9:29am UTC](https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754 "2020-08-04T09:29:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![crazymaster7](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/crazymaster7/32/77_2.png) [@crazymaster7](https://forums.powershell.org/u/crazymaster7)\
**Post date:** [August 4, 2020, 9:29am UTC](https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754/1 "2020-08-04T09:29:46Z")

</div>

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
`
```

---

<div class="post-metadata">

**Author:** ![random-commandline](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@random-commandline](https://forums.powershell.org/u/random-commandline)\
**Post date:** [August 5, 2020, 3:45am UTC](https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754/2 "2020-08-05T03:45:45Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![crazymaster7](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/crazymaster7/32/77_2.png) [@crazymaster7](https://forums.powershell.org/u/crazymaster7)\
**Post date:** [August 5, 2020, 7:24am UTC](https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754/3 "2020-08-05T07:24:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [August 5, 2020, 9:37am UTC](https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754/4 "2020-08-05T09:37:31Z")

</div>

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 ??

---

<div class="post-metadata">

**Author:** ![crazymaster7](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/crazymaster7/32/77_2.png) [@crazymaster7](https://forums.powershell.org/u/crazymaster7)\
**Post date:** [August 5, 2020, 8:34pm UTC](https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754/5 "2020-08-05T20:34:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/monthly-clustered-scheduled-task-trigger/14754/6 "2024-05-16T20:29:05Z")

</div>


