My server at work has some scheduled tasks that run every night. They run when no user is logged into the system. They run batch files which open MS-Access databases with macros inside. Occasionally these are not closed by the script, their process is still running and their .ldb
lock file hangs around.
I've watched them run before and I've seen that an MS-Access window popups up, and if it completes successfully, then the window closes and there isn't a problem. However, if it fails, then the lock file and the process remain. I'm assuming that maybe there's a window somewhere too…I know that in Linux if your program has a Window in an XWindows session, you can transfer it to another XWindows session; is the same thing possible on Windows?
Best Answer
Changing my answer since you changed the tag from Server 2008 to 2003... and I wasn't really accurate with my first answer.
Whatever account is configured to run the scheduled task, a logon session is created for that account every time the task runs, a window station is created for that logon, and the windows are created in that window station/logon session. When the task is done, the user account is logged off... with the exception of the system accounts of course. They never log off.
Also, Server 2003 doesn't have the session 0 isolation that 2008+ does. It's worth noting that this works much differently in 2008+ than it does in 2003. In 2008, scheduled tasks are spawned by taskeng.exe, which is spawned by svchost.exe, meaning the scheduled task runs in Session 0 regardless of whether the task runs as SYSTEM or as a normal user. But if the task is set to run as SYSTEM on 2003, it works almost the same as it does in 2008 where the task is created by svchost.exe in Session 0. In Server 2003, Session 0 is simply the "console" session, and you can access it over RDP with the /console (/admin in Vista/2008+) and you will log in to Session 0, but it generates a new window station for you, so you won't be able to see that scheduled task's windows that were launched by System.
In Vista/2008+, this sort of activity would likely trigger the Interactive Services Detection service, which is meant to transfer you to Session 0's desktop when an interactive dialog box pops up, but not unless another user was logged in at the same time for the ISD service to alert.
So keep that in mind when it comes time to migrate off of your 10 year old OS.
From the NTDebugging blog:
From an old MS KB:
There's no way to pass a process and all of its windows into another user's session or somehow inject it into their desktop... at least not without some major programming... that would be a very interesting program to try to make.
Lastly, the comments on this post on Mark Russinovich's blog are quite interesting and relevant: