OK this one is driving me nuts.
I try to import it to another machine using the following code:
$User = "domain\administrator" $XML = get-content 'C:\Folder1\task.xml'| out-string Register-ScheduledTask -TaskName "TASK" -Xml $XML -User $User -Password P@ssw0rd -Force
Register-ScheduledTask : The parameter is incorrect. At line:3 char:1 + Register-ScheduledTask -TaskName "TASK" -Xml $XML -User $User -Password P@ssw ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-ScheduledTask], CimExc eption + FullyQualifiedErrorId : HRESULT 0x80070057,Register-ScheduledTask
I'm lost, tried all sorts.
Register-ScheduledTask -Xml (get-content 'C:\Folder1\task.xml'| out-string) -TaskName "TASK" -User $User -Password P@ssw0rd –Force
...returns same result as essentially is same code. But only decent example I could find formats the code like this.
I would very much appreciate any help.
Have you tried delimiting the password in quotation marks?
Hi Don. Thanks for the speedy response!
I have just tried that, returns same error unfortunately. 11:16 PM here, think I've looked at it for too long now....
Read this, gave it a new name and it worked.
I know this topic has been dormant for a while, but I came across it as I was having the same issue.
The good news is I'm pretty sure I've tracked down the registry keys that represent the corrupted scheduled task!
Search each for the name of the task you are trying and failing to create.
It did the trick for me!
You must be logged in to reply to this topic.