Task Scheduler - cannot edit any tasks (error 2147750680)

Georgi Iovchev 20 Reputation points
2023-11-18T13:57:39.9533333+00:00

Hi, I am having very strange issue with Task Scheduler.
I can create run or delete scheduled stasks, but I cannot edit them.
Whatever edit to a task (my task) results in error 2147750680.
For example, change only the description.
Screenshot 2023-11-16 215555

I get same error also when I try to import task (xml). I tried also with powershell, but there I got other error which I don't understand.Screenshot 2023-11-16 220544

Set-ScheduledTask : The task XML contains a value which is incorrectly formatted or out of range. 
(44,4):Task: 
At line:1 char:9 
+ $task | Set-ScheduledTask 
+         ~~~~~~~~~~~~~~~~~ 
    + CategoryInfo          : NotSpecified: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Set-ScheduledTask], 
   CimException 
    + FullyQualifiedErrorId : HRESULT 0x80041318,Set-ScheduledTask

My user have admin privileges. But even if I run Task scheduler or powershell as admin, I get the same issue. As a workaround, I can delete the task and recreate it from scratch with whatever settings I need, but that is not very convenient.

I am running Windows 11 23H2 22631.2506, that was recently upgraded from 11 22H2. Before the upgrade, I think task scheduler was working fine. I have also another machine with same windows 11, but there is no such problem with task scheduler.

Need help to fix this issue without reinstalling my machine.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,450 questions
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 33,376 Reputation points
    2023-12-09T20:16:50.9733333+00:00

    It would appear that the task scheduler does not like 2 character user names.

    Edd works but Ed doesn't.

    PS C:\> Get-LocalUser -Name e*
    
    Name Enabled Description
    ---- ------- -----------
    ed   True
    edd  True
    
    
    PS C:\> $name = "Test1zzz"
    PS C:\> Unregister-ScheduledTask -TaskName $name -Confirm:$false -ea SilentlyContinue
    PS C:\> $action = New-ScheduledTaskAction -Execute "C:\temp\blabla.exe"
    PS C:\> $trig = New-ScheduledTaskTrigger -once -at "12am"
    PS C:\> $prin = New-ScheduledTaskPrincipal -UserId "ed"
    PS C:\> Register-ScheduledTask -TaskName $name -Action $action -Trigger $trig -Principal $prin
    Register-ScheduledTask : The task XML contains a value which is incorrectly formatted or out of range.
    (45,4):Task:
    At line:1 char:1
    + Register-ScheduledTask -TaskName $name -Action $action -Trigger $trig ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-ScheduledTask], CimException
        + FullyQualifiedErrorId : HRESULT 0x80041318,Register-ScheduledTask
    
    PS C:\> $task = Get-ScheduledTask -TaskName $name -ea SilentlyContinue
    PS C:\> $task.Description = "Updated desc."
    The property 'Description' cannot be found on this object. Verify that the property exists and can be set.
    At line:1 char:1
    + $task.Description = "Updated desc."
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : PropertyNotFound
    
    PS C:\> $task | Set-ScheduledTask  -ErrorAction SilentlyContinue
    PS C:\>
    PS C:\> Unregister-ScheduledTask -TaskName $name -Confirm:$false -ea SilentlyContinue
    PS C:\> $action = New-ScheduledTaskAction -Execute "C:\temp\blabla.exe"
    PS C:\> $trig = New-ScheduledTaskTrigger -once -at "12am"
    PS C:\> $prin = New-ScheduledTaskPrincipal -UserId "edd"
    PS C:\> Register-ScheduledTask -TaskName $name -Action $action -Trigger $trig -Principal $prin
    
    TaskPath                                       TaskName                          State
    --------                                       --------                          -----
    \                                              Test1zzz                          Ready
    
    
    PS C:\> $task = Get-ScheduledTask -TaskName $name
    PS C:\> $task.Description = "Updated desc."
    PS C:\> $task | Set-ScheduledTask
    
    TaskPath                                       TaskName                          State
    --------                                       --------                          -----
    \                                              Test1zzz                          Ready
    
    
    PS C:\>
    

    Schtasks has the same issue.

    PS C:\> Unregister-ScheduledTask -TaskName Test1zzz -Confirm:$false -ea SilentlyContinue
    PS C:\> schtasks.exe /create /tn Test1zzz /ru ed /sc once /st 23:01 /tr C:\temp\blabla.exe
    ERROR: The task XML contains a value which is incorrectly formatted or out of range.
    (39,4):Task:
    PS C:\>
    PS C:\> Unregister-ScheduledTask -TaskName Test1zzz -Confirm:$false -ea SilentlyContinue
    PS C:\> schtasks.exe /create /tn Test1zzz /ru edd /sc once /st 23:01 /tr C:\temp\blabla.exe
    SUCCESS: The scheduled task "Test1zzz" has successfully been created.
    PS C:\>
    

    BUT!!!!!!!!! If you add the computername to the local account, it will work.

    PS C:\> $name = "Test1zzz"
    PS C:\> Unregister-ScheduledTask -TaskName $name -Confirm:$false -ea SilentlyContinue
    PS C:\> $action = New-ScheduledTaskAction -Execute "C:\temp\blabla.exe"
    PS C:\> $trig = New-ScheduledTaskTrigger -once -at "12am"
    PS C:\> $prin = New-ScheduledTaskPrincipal -UserId "$env:COMPUTERNAME\ed"
    PS C:\> Register-ScheduledTask -TaskName $name -Action $action -Trigger $trig -Principal $prin
    TaskPath                                       TaskName                          State
    --------                                       --------                          -----
    \                                              Test1zzz                          Ready
    PS C:\> $task = Get-ScheduledTask -TaskName $name -ea SilentlyContinue
    PS C:\> $task.Description = "Updated desc."
    PS C:\> $task | Set-ScheduledTask  -ErrorAction SilentlyContinue
    PS C:\>
    SilentlyContinue
    PS C:\> $action = New-ScheduledTaskAction -Execute "C:\temp\blabla.exe"
    PS C:\> $trig = New-ScheduledTaskTrigger -once -at "12am"
    PS C:\> $prin = New-ScheduledTaskPrincipal -UserId "$env:COMPUTERNAME\edd"
    PS C:\> Register-ScheduledTask -TaskName $name -Action $action -Trigger $trig -Principal $prin                                                                                                                                                                                                                                                                                                                                                                                                  TaskPath                                       TaskName                          State                                                                                                                                                          --------                                       --------                          -----                                                                                                                                                          \                                              Test1zzz                          Ready                                                                                                                                                          
    PS C:\> $task = Get-ScheduledTask -TaskName $name
    PS C:\> $task.Description = "Updated desc."
    PS C:\> $task | Set-ScheduledTask
    TaskPath                                       TaskName                          State
    --------                                       --------                          -----
    \                                              Test1zzz                          Ready
    PS C:\>
    PS C:\>
    PS C:\>
    PS C:\> Unregister-ScheduledTask -TaskName Test1zzz -Confirm:$false -ea SilentlyContinue
    PS C:\> schtasks.exe /create /tn Test1zzz /ru "blackhole\ed" /sc once /st 23:01 /tr C:\temp\blabla.exe
    SUCCESS: The scheduled task "Test1zzz" has successfully been created.
    PS C:\>
    
    

    From the gui, it will show up as Ed, Reselect the user so that it contains the computer name.

    User's image

    User's image


2 additional answers

Sort by: Most helpful
  1. MotoX80 33,376 Reputation points
    2023-11-19T16:56:42.1633333+00:00

    2147750680 is 0x80041318.

    I found this post.

    https://superuser.com/questions/1133085/windows-10-task-scheduler-error-xml-contains-a-value-which-is-incorrectly-forma

    Based on that, you can try updating the account that the task runs as. Next I would suggest making a trivial change to the tasks trigger. Maybe modify the "Stop task if it runs longer than" setting.

    Is your trigger set to repeat?

    If that doesn't work, then open a command prompt with Run as Administrator and "cd C:\Windows\System32\Tasks". Then open a task file with notepad. Do you see the MaintenanceSettings that the post described?

    Maybe post one of the tasks XML back here and see if any user can see something.


  2. Georgi Iovchev 20 Reputation points
    2023-11-21T10:40:15.16+00:00

    I tried to reply as comment thousand times but for some reason it does not get saved. Last try and I give up.

    What I was trying to say is that if I change the user to be someone else (or create it initially to run with another account - SYSTEM for example) then I can edit everything in the task. So the problem is only if the task is to run as my user.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.