running a task on demand via schtasks on Win11

John Larew 5 Reputation points
2026-10-29T19:36:55.0166667+00:00

I successfully created a job via schtasks /create...., and can see it is correct via schtasks /query.

When I issue the command "schtasks /run /i /tn [jobname]", I get the response "SUCCESS: Attempted to run the scheduled task "[jobname]" ". However, the job doesn't run, as indicated by "schtasks /query /fo list /tn [jobname]" (partial output follows):

TaskName:                             \[jobname]
Next Run Time:                        N/A
Status:                               Ready
Logon Mode:                           Interactive only
Last Run Time:                        11/30/1999 12:00:00 AM
Last Result:                          267011

BTW, I've correctly set the "Logon as a batch job" Security Policy to include the Run as User for this job. I've also run the Task to Run from the interactive command line successfully.

Thanks in advance for any insight you might provide.

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments

2 answers

Sort by: Newest
  1. Marcin Policht 112.4K Reputation points MVP Volunteer Moderator
    2026-10-29T21:22:55.36+00:00

    The value in the string Last Result: 267011 converts to hexadecimal 0x41303, which is SCHED_S_TASK_HAS_NOT_RUN. It indicates that Task Scheduler has not recorded a completed execution of the task. The Last Run Time of 11/30/1999 12:00:00 AM is a placeholder, not an actual execution timestamp. The SUCCESS: Attempted to run the scheduled task message confirms only that Windows accepted the request to start the task, not that the task actually executed.

    The first thing to investigate is the task's Logon Mode: Interactive only. This indicates that the task is configured to run only when the specified user is logged on. The Log on as a batch job right does not override that configuration. If you created the task with /IT, it requires the user's interactive session. Try running the task while signed in as the configured Run as User account, and confirm that the task's configured logon type matches your intended execution scenario. If the task must run without that user being logged on, recreate or update it to use a non-interactive logon configuration, with the appropriate credentials and permissions.

    Next, inspect the task's complete configuration using schtasks /query /tn "[jobname]" /xml and review the LogonType, UserId, Triggers, Actions, and Settings elements. Also enable Task Scheduler's Operational log under Event Viewer at Applications and Services Logs > Microsoft > Windows > TaskScheduler > Operational, then issue schtasks /run /tn "[jobname]" and inspect the events generated at that time. These events can help distinguish a task-launch failure from an action that starts and immediately exits.

    Since you have already verified that the command runs successfully from an interactive command line, focus first on the task's configured logon type, the account under which the action executes, and the Task Scheduler Operational log. The fact that the task works interactively does not mean that it can run under the task's configured security context.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-10-29T19:38:01.6266667+00:00

    Run the task with schtasks /run /tn "[jobname]" while the task’s Run As User is logged on; /i is not a valid option for schtasks /run, and the task is configured as Interactive only.

    schtasks /run /tn "[jobname]"
    schtasks /query /tn "[jobname]" /v /fo list
    

    The documented /run syntax contains /tn, /s, /u, and /p, but no /i. It starts the task using the program path, account, and password stored in the task definition.^1^

    What the current output means

    • Logon Mode: Interactive only means the task runs only when its configured Run As User is logged on. This property normally comes from /it, not /i.^2^
    • Last Result: 267011 is decimal 0x00041303, or SCHED_S_TASK_HAS_NOT_RUN: the task has not yet run.^3^
    • SUCCESS: Attempted to run... confirms that Task Scheduler accepted the request; it does not confirm that the action started or completed.
    • /i belongs to schtasks /create for an ONIDLE schedule, where it specifies the idle interval. Interactive-only behavior is selected with /it.^4^

    Therefore, verify that the account displayed as Run As User in the verbose query has an active signed-in session—not merely that another administrator is signed in.

    If the task must run without that user logged on

    Recreate the task without /it. The command-line /change operation can add interactive-only mode but cannot remove it.^2^

    Before deleting anything, export the existing task from Task Scheduler → Task Scheduler Library → right-click the task → Export. Then recreate it without /it, supplying the intended /ru account and its /rp password as required. Deleting the existing task is destructive, so retain the exported XML until the replacement works.

    If the program displays windows or prompts, either:

    • keep Run only when user is logged on, or
    • modify it to run non-interactively and write output to a file or event log.

    If it still does not start

    Since the executable already works interactively and the batch-logon right is already assigned, do not repeat those checks. Instead:

    1. Open Task Scheduler, select the task, and inspect its History tab.
    2. Open Event Viewer → Applications and Services Logs → Microsoft → Windows → TaskScheduler → Operational.
    3. Look for the event immediately following the manual run request. It should identify whether the request was rejected by a task condition, principal/session setting, or action configuration.
    4. If History is empty, enable task history and retry once.
    5. Export the task XML and preserve the Operational log if escalation is required.

    Microsoft’s troubleshooting procedure specifically recommends the History tab and TaskScheduler Operational log, and suggests using Run only when user is logged on to isolate security-context problems.^5^


    References

    1. schtasks run
    2. schtasks change
    3. Task Scheduler error and success constants
    4. schtasks create
    5. Troubleshoot issues with scheduled tasks not running
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

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