I'm trying to set up a Scheduled Task that runs for all users upon logon, specifically as the System User. The goal is for it to trigger right when a user logs in, not during system boot. However, I've noticed that it can take anywhere from 30 seconds to a minute after the user reaches the desktop for the task to actually initiate. This timing is problematic as this task is crucial for a workflow that users typically need right when they log in. I'm aware that the Registry Run setting runs under the current user rather than as System, and it also takes time. I've attempted using a delayed start of 30 seconds for the task, but that hasn't resolved the issue either.
6 Answers
If your machines are part of a domain, you might leverage Group Policy Objects (GPO) to manage user logon scripts or tasks more effectively. That could potentially give you more control over when these tasks are executed.
One thing you could try is adjusting the Startup items settings in the registry. You might want to change these registry values: [HKEY_Current_UserSOFTWAREMicrosoftWindowsCurrentVersionExplorerSerialize] and set both "StartupDelayInMSec" and "WaitForIdleState" to 0. This could help start your task without the usual delay, but make sure to back up anything before changing the registry.
It sounds like a bottleneck issue, as these tasks may not all execute simultaneously. They often wait until all start-up services are initiated. If possible, you could convert the task into a service itself, which might help it kick in much faster during startup.
Actually, the behavior you're seeing is pretty standard. The Task Scheduler triggers on the logon event, but there's always a slight delay because it waits for the event to register instead of launching immediately. Unfortunately, that's just how it works—there will always be a bit of lag after the user logs in.
If the 30-second delay is critical for you, consider switching from the logon trigger to monitoring the event ID for a successful authentication. This could enable you to run the task much sooner.
Have you considered running the Scheduled Task under a Service account instead? That way, you might get it to trigger more reliably when users log in.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures