0X80041318 Task XML Error: What Triggers It and How to Fix
This error pops up when Windows Task Scheduler rejects a task's XML due to bad dates, empty fields, or out-of-range values. Here's how to nail it down.
When Does This Error Show Up?
You've just exported a scheduled task from one Windows machine — maybe a backup script or a custom PowerShell job — and you're trying to import it on another. You click Import Task in Task Scheduler, browse to the .xml file, and bam: "SCHED_E_INVALIDVALUE (0X80041318) - The task XML contains a value that is incorrectly formatted or out of range". Another common trigger: you edit a task's XML directly (not recommended, but people do it), save it, and Task Scheduler barfs at you. This error is almost always about a date, time, or numeric value that doesn't fit inside Windows' strict rules.
Root Cause in Plain English
Your task's XML — that big blob of text inside the .xml file — has a value that Windows Task Scheduler can't swallow. The usual suspects:
- Bad trigger dates — like a start date in the past that's older than the task's own internal limits (usually 31 days back from when you're importing it).
- Empty or missing required fields — for example, a
<Duration>tag that's empty when a duration is required, or a<RandomDelay>with no value. - Numbers out of range — like setting a repeat interval to 0 minutes (which doesn't exist), or a priority value outside 0–10.
- Incorrect XML structure — a missing closing tag or a value with a stray character (like a space inside a date).
I've seen this most often when someone copies a task from an older Windows version (like Windows 7 or 8) and tries to import it on Windows 10 or 11. The XML schema changed slightly, and Task Scheduler on newer Windows is pickier about formats.
How to Fix the 0X80041318 Error
We're going to open the XML file in a text editor, find the bad value, and fix it. You don't need any special tools — Notepad works fine.
Step 1: Open the Export XML in Notepad
Right-click the .xml file that's causing the error and choose Open with > Notepad. Don't double-click it — that'll try to import it again and you'll just get the same error.
Step 2: Look for Date-Time Values
Search (Ctrl+F) for <StartBoundary> or <EndBoundary>. You'll see something like this:
<StartBoundary>2023-04-10T09:00:00</StartBoundary>
If that date is more than about 31 days in the past from today's date, Task Scheduler will reject it. Fix it: change the date to today or a future date. Use the format YYYY-MM-DDTHH:MM:SS — no spaces, no extra characters.
Example for today: 2025-02-16T14:00:00
Step 3: Check for Empty Tags
Search for any tag that looks empty, like <Duration></Duration> or <RandomDelay></RandomDelay>. These are often the culprit. If the task doesn't need a duration, delete the entire <Duration> element (from the opening tag to the closing tag). Same for <RandomDelay>.
But if the task does need a duration (like for a repeat trigger), add a valid value. For example, <Duration>PT1H</Duration> for one hour. The format uses ISO 8601: PT for period time, then hours/minutes/seconds.
Step 4: Look for Out-of-Range Numbers
Search for <Priority> — valid values are 0 (highest) through 10 (lowest). If you see 11 or -1, change it to something sane like 7. Also check <ExecutionTimeLimit> — if it's set to PT0S (zero seconds), that's invalid. Set it to PT72H if you want a 3-day limit, or delete the tag entirely to allow unlimited time.
Step 5: Fix Missing Tags
Sometimes a task's XML is missing a required tag like <Repetition> inside a trigger. If the trigger has a <Repetition> child tag, it must include both <Interval> and <Duration>. Neither can be empty and neither can be zero.
Example of a valid repetition:
<Repetition>
<Interval>PT5M</Interval>
<Duration>PT1H</Duration>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
Step 6: Save and Re-import
Save the .xml file (Ctrl+S), then go back to Task Scheduler, click Import Task, and select the fixed file. It should import cleanly now.
What If It Still Fails?
If you're still getting the error after checking dates, empty tags, and numbers, there's probably a structural problem in the XML itself — like a missing closing tag or an extra bracket. Open the XML in Notepad again, and look for anything that looks off. A quick sanity check: search for </ and count if there's a matching closing tag for every open one. If you're comfortable with it, you can validate the XML using an online validator (like xmlvalidation.com), but skip that if the file is huge.
Another thing I've seen: if you exported the task from a 32-bit version of Windows and you're importing on a 64-bit one, the XML itself might reference 32-bit paths (like C:\Program Files (x86)\SomeApp\task.exe). That's not the 0X80041318 error, but it'll cause a different one. Still, double-check the <Command> tag inside <Actions> for weird path references.
Worst case: delete the task and recreate it from scratch inside Task Scheduler. It's faster than debugging a corrupted XML for an hour. I've been there — sometimes the export on the source machine is already borked, and you're just polishing a turd.
Was this solution helpful?