The Task Scheduler error “A specified logon session does not exist” appears when Windows cannot use saved credentials for a scheduled task.
When you set up a scheduled job and it fails with the message “A specified logon session does not exist. It may already have been terminated”, Windows is telling you that the user account behind the task cannot be used in the way it has been configured. The scheduler tried to start your script or program, but there was no valid logon session that matched the security settings on the task.
The string A Specified Logon Session Does Not Exist – Task Scheduler commonly appears when you pick Run whether user is logged on or not for a task, while a local or domain policy blocks Windows from storing that account’s password. In that mix, the scheduler has no session it can reuse and no password it can cache, so the task never starts at all.
The good news is that this problem usually comes down to a short list of settings: one local security policy, a few Task Scheduler options, and sometimes the status of the account that runs the job. By working through them in a steady order you can get the task to run on schedule again without weakening the rest of your Windows setup.
What This Task Scheduler Error Message Actually Means
Task Scheduler runs in a service context and relies on stored credentials to start jobs under the accounts you choose. From Windows Vista onward, it uses Credential Manager under the hood to keep those details safe. When that system cannot find a valid logon session and also cannot read or write the credentials it needs, it raises the error text about a missing logon session and stops there.
In practice, the problem appears when you:
- Create or edit a task and see an error as soon as you enter the account and password.
- Run a task on demand and it fails before your script even starts, with the HRESULT 0x80070520 or error code 1312 in the event log.
- Schedule a background job that works only while you are logged on interactively, but fails when you log off the server or workstation.
In all of these cases, Windows cannot tie the task to a persistent, reusable session for the account you entered. Either the session never forms, or a policy blocks the storage of the credentials the scheduler needs to create one in the background.
A Specified Logon Session Does Not Exist – Task Scheduler Causes
Several settings can sit behind this same message. The scheduler gives you a single error string, so it helps to know which patterns line up with which root cause.
- Local security policy blocks stored passwords — The classic trigger is the policy Network access: Do not allow storage of passwords and credentials for network authentication set to Enabled while the task uses Run whether user is logged on or not. In that case, Credential Manager is blocked from storing the logon data that Task Scheduler needs.
- “Do not store password” style options are active — Some builds and management tools expose a check box that prevents password storage for tasks, which leads straight to this error when the job is meant to run without an interactive session.
- The account password changed — If the user’s password changed, expired, or was reset and the stored credentials for the task stayed old, the scheduler cannot create a matching session any more. It tries, fails to authenticate, and reports a missing logon session.
- The account is disabled or locked — A disabled, locked, or deleted account cannot log on, so any task that still points at it will raise logon failures and may surface the same message in logs and status panels.
- The task relies on domain resources with no domain reachability — When the account or network path sits in a domain and the machine cannot reach a domain controller, the scheduler cannot validate the credentials, which again leaves it without a valid session.
The best fix for your setup depends on which of these patterns fits your server or workstation, so start with quick checks inside Task Scheduler itself before you touch system policies.
Quick Checks Before You Change Security Policies
Before you adjust any local or group policy, run a few short checks inside Task Scheduler. These checks either clear the error straight away or point you toward the deeper fix that matches your case.
- Test the task with “Run only when user is logged on” — Open the task, switch to the General tab, and change the security option to run only while the user is logged on. Save the task and run it by hand. If it now works, the account and script are fine, and the failure comes from background logon and credential storage.
- Re-enter the password for the task account — Still on the General tab, confirm that the user name is the one you intend to use. Click OK, then enter the account password again when prompted. This refreshes the stored credentials in case a password change caused the break.
- Check if the account is active — Verify in local users or directory tools that the account is not disabled, locked, or flagged to change password at the next logon. A task that runs under such an account often fails during background logon.
- Look at the task history and event logs — Enable task history, then run the job by hand. The history pane and the Microsoft-Windows-TaskScheduler log in Event Viewer can show codes such as 0x80070520 or 2147943726 that confirm a logon failure rather than a script error.
If the task runs correctly only with an interactive session and fails again as soon as you switch back to background mode, the next step is to align system policy with the way you want the job to run.
Fix Task Scheduler Logon Session Error By Adjusting Security Policy
The most common long term fix for this problem is to change the local or domain security policy that blocks storage of credentials. Microsoft’s own performance team explains that the missing logon session error appears when that specific policy is enabled and a task tries to store credentials for background use.
Disable The “Do Not Allow Storage Of Passwords” Policy Locally
On standalone servers and workstations, you can change the setting directly in the local security console.
- Open Local Security Policy — Press Win+R, type secpol.msc, and press Enter.
- Browse to Security Options — In the left pane, expand Local Policies, then click Security Options.
- Locate the network access policy — In the right pane, find Network access: Do not allow storage of passwords and credentials for network authentication.
- Edit the policy — Double-click it, set it to Disabled, and press OK.
- Refresh policy — Either restart the machine or run gpupdate /force from an elevated command prompt.
- Recreate or save the task — Open Task Scheduler, configure the task with Run whether user is logged on or not, enter the account password, and save again.
Once this setting is disabled, Credential Manager can store the task’s logon information again, and Task Scheduler can create the required background session without raising the error about a missing logon session.
Handle The Policy Through Group Policy
On domain-joined systems, the same policy often comes from a central Group Policy Object. In that case you change it in the Group Policy Management Console on a management server instead of in the local console. The path is the same security option, under the computer configuration branch of the GPO.
After the GPO change reaches the machine and policies refresh, try saving the task again with background running enabled. If the error disappears and the job runs on schedule while you stay logged off, the policy conflict was the main cause.
Task Scheduler Logon Session Error Fixes Without Policy Changes
Sometimes you cannot change security policy at all, especially on shared servers that follow strict baseline rules. In that case you still have a few options that keep the task running while staying within those limits.
- Run the task only when the user is logged on — This setting lets the scheduler reuse the interactive logon session instead of storing credentials. It works well for admin utilities or scripts that you launch during your own session and do not need overnight.
- Use a dedicated service account — Create or request an account meant for services and scheduled jobs, with a non-expiring password and the least rights needed. Store those credentials in the task once and keep the account stable, so password changes do not break the schedule.
- Avoid mapped drives in unattended tasks — Use UNC paths such as
\\server\share\folderinstead of drive letters that rely on an interactive logon. This avoids extra dependencies on logon sessions that may not exist once nobody is signed in. - Grant direct access to needed resources — File shares, databases, and other services should allow the task’s account to connect directly, without extra credential prompts that cannot appear during a background run.
These approaches trade some convenience for reliability, yet each one keeps your tasks away from the specific mix of settings that trigger the missing logon session error.
When The Error Points To Broader Credential Problems
In a few cases, the text about a missing logon session is just one symptom of a wider credential problem on the system. You might see it in Task Scheduler at the same time as failures in other tools that also depend on stored tokens.
The table below links common patterns to the checks that help you narrow them down.
| Pattern | What You See | What To Check |
|---|---|---|
| Policy conflict | Tasks fail in background only, error mentions missing logon session. | State of the network access password storage policy and task security options. |
| Password drift | Tasks worked, then started failing after a password change. | Stored credentials inside the task, account password age, lockout status. |
| Domain reachability | Tasks and network logons fail together on domain accounts. | Connectivity to domain controllers, DNS health, time sync on the machine. |
| Broader logon issues | Other tools show the same “specified logon session” text. | Recent system changes, security software, or certificate changes that affect credential handling. |
If you see patterns across several services on the same host, treat the Task Scheduler error as a symptom and review recent security hardening steps, template updates, and certificate changes that might touch logon or credential storage.
Safe Task Scheduler Practices To Avoid Logon Session Errors
Once the current task works again, it pays to harden your habits so the same logon session problem does not return during the next password change, server refresh, or policy update.
- Plan the account story for each task — Decide whether a job should run as a person, a service account, or the system account, and configure rights and passwords accordingly.
- Keep passwords stable for service accounts — Where policy allows, assign non-expiring passwords to accounts that run long term jobs. If you must rotate passwords, schedule time to update the stored credentials in every affected task.
- Document the link between tasks and policies — Note which tasks depend on background logon with stored credentials so that later security changes take them into account.
- Test after policy changes — When password storage or logon settings change on a server, run a short pass through your scheduled jobs list and confirm that each one still starts correctly.
- Review event logs regularly — Task history and related security logs often show early warnings about background logon problems long before end users notice missing jobs.
With those habits in place, A Specified Logon Session Does Not Exist – Task Scheduler becomes a message you seldom see, and when it does appear you already know which settings to check first. The scheduler goes back to starting your scripts, backups, and maintenance jobs on time, while your password and policy setup stays tidy and predictable.
