I have a funky situation where a certain batch-type application works correctly when run on the console (via RDP or when physically logged on to the box), but doesn't work correctly when run via RDP on a non-console session or, for that matter, when executed by the Windows Task Scheduler.
I know how to determine programmatically if my process is running on the console or not by checking the SESSIONNAME environment variable.
My question is, if I determine that I'm NOT running on the console, I want to either switch to the console (seems unlikely due to window station restrictions), or more likely, re-launch the process but force it to run on the console session.
It's really an issue for processes that get kicked off via Windows Task Scheduler since they don't seem to run on the console.