Auto Launching Apps on TS
You are in process of deploying a Terminal Server centralized application for 80 users. One major requirement is that when users logon to the Terminal Server computer, the default application have to launch automatically and the user can only work on that particular app.
You can accomplish this at the RDP Connection Configuration level by setting a command line batch for all the users. But the challenge comes when you don’t want the auto launch of the app to execute for an Administrator or Power User.
When you set the RDP Configuration initial program, it gets applied to anyone that connects to the server from a Terminal Server Client or remote. Does not apply to the login on the console.
Here is what I come up with:
First I got a hold of the ifmember.exe utility from Microsoft Windows NT Resource Kit Supplement 4. I placed this utility under %SystemRoot%\System32 folder and gave the Everyone group, Change permission rights.
Next, I wrote a batch file that launches the application automatically. If the user, login to Terminal Server belongs to the Administrators group then the auto launch does not execute. See listing 1 as an example: autoapp.cmd
Listing 1. |
@echo off ifmember "Medina\Domain Admins" if not errorlevel 1 goto user Start Explorer.exe exit :user @echo off con2prt /f /cd \\tikata\accounting START /MAX D:\Office\Office\msaccess.exe F:\UsersDB\%USERNAME%.MDB Exit |
I placed the batch file on a folder where all users can read it, and applied to the Everyone group, Change NTFS permissions. As you can see the file checks if you are an Administrator, if you are then you’ll get a normal desktop. If not then you be force to go to a regular User and have the application launch automatically.
Once you have the batch and all necessary components ready, then you need to setup the Terminal Server RDP Configuration to launch the batch. To do this go to Start\Administrative Tools\Terminal Server Connection Configuration.
Double click on your default RDP connection (rdp-tcp) see figure 1. Next dialog box click the "Advanced" button. On the next dialog box "Advanced Connection Settings" you’ll see a setting called "Initial Program", uncheck the "inherit client/user config" and in the command line box type the path of the batch file, example D:\autoapp.cmd . Click OK and the changes will be apply to the Terminal Server Computer. See figure 2.
Figure 1.
Figure 2.
Next time a user logs in to the Terminal Server, the batch will launch and the application will auto start.
Have fun.