I am facing a problem with triggers for the Clustered monthly task on Windows 2012 server via Powershell, I am a novice in scripting and looking help on this issue.
Below is the 'Powershell commands' trying to run the task every month 29th
$Trigger = New-ScheduledTaskTrigger -At 05:00am -Daily
if ((Get-Date).day -eq 29) { $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