Powershell - Set-ClusteredScheduledTask - Error "Incorrect function."
Solution 1:
Are you trying to update an already registered cluster task or to register a new cluster task ?
From MSDN Blog :
Set-ClusteredScheduledTask : Update an already registered cluster task.
Register-ClusteredScheduledTask : Register a cluster task.
I guess you are looking for Register-ClusteredScheduledTask.
Solution 2:
You need to add the -TaskType parameter and run it as admin:
$trigger = New-ScheduledTaskTrigger -at 12:00 -Once
$action = New-ScheduledTaskAction -Execute "notepad"
Register-ClusteredScheduledTask -Action $action -TaskName "clusteredtasktest" -Trigger $trigger -TaskType anynode
Solution 3:
We worked with Microsoft to resolve this. Our problem was that the Admin had defined "Task Scheduler" as part of the "BizTalk2013" cluster node (OwnerGroup as seen on get-ClusterResource cmdlet). We deleted that ClusterResource. In our case "BizTalk2013" was our "OwnerGroup", which apparently needs to be "Task Scheduler".
It turns out that if our admin had not done anything, then running the Register-ClusteredScheduledTask cmdlet would have worked, and added "Task Scheduler" under a node called "Task Scheduler". I'm trying to find the blog that he followed in setting it up the way he did.