How can I automatically launch a terminal services session when the server boots?
Posted on 2009-05-13
I have a Server running 2003 Server Standard. It functions primarily as a terminal server, but also runs a background application that needs to be started at system startup and remain running indefinitely. The background app runs on it's own account in a ts session that is usually disconnected, though I do need to be able to connect to it now and again.
I've tried a number of methods without success:
1. Start the background app using the windows task scheduler. (This runs the app, but not in a session that I can connect to.)
2. Start an mstsc session using the windows task scheduler. (After it boots, I can see the mstsc.exe in task manager processes, but the account does not logon on successfully. Terminal Services Manager shows no sessions other than the console.)
3. Use autoadminlogon to automatically log on an account with a logon script that launches the mstsc session, then logs itself off, leaving the mstsc session active but disconnected. (This works, except that the defaultusername setting changes as different people log on to the console session, causing the autoadminlogon to fail.) Strangely the same script that works here does not work if launched by task scheduler.
Any help would be greatly appreciated.