Im trying to import task with Powershell and getting this error BTW using import in Task Scheduler is working fine
CMDLINE: PS C:\windows\system32> Register-ScheduledTask -Xml "C:\Windows\System32\Tasks\Microsoft\Windows\TextServicesFramework\MsCtfMonitor" -TaskName "MsCtfMonitor"
Error: Register-ScheduledTask : The task XML is malformed. (1,2)::ERROR: incorrect document syntax At line:1 char:1
+ CategoryInfo : NotSpecified: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-ScheduledTask], CimException
+ FullyQualifiedErrorId : HRESULT 0x8004131a,Register-ScheduledTask
You need to pass the actual text of the xml, rather than just the file path:
Register-ScheduledTask -Xml (Get-Content ("C:\Windows\System32\Tasks\Microsoft\Windows\TextServicesFramework\MsCtfMonitor") | Out-String ) -TaskName "MsCtfMonitor"
User contributions licensed under CC BY-SA 3.0