You are hereRDP, Terminal Server, and 2 Annoyances

RDP, Terminal Server, and 2 Annoyances

By steve - Posted on 19 July 2013

I use terminal server a lot with my clients. I was trying to set up RDP sessions to run a certain program and quit (rather than just opening up an RDP session and running the program from there). I do this so that I can run a program and get out. For instance, I have some web-based server management interfaces that are only available from inside the network (like for the phone systems) and if I just want to go in and fix something, I don't want to have to run a VPN session and I don't want to get a full desktop to start a browser, so I just fire off the browser as a program in an RDP session and I'm in and out!

However, I was running into 2 annoyances:

1) I would set up an RDP session to run one program, but the session would hang when the program exited. The session would stay hung so that when I came back and re-connected, I got the same hung desktop session back!

2) No matter what I changed in the RDP settings or on the server, every time I opened an RDP sessions file, my window would have scroll bars with my desktop bigger than the window that RDP opened!

Both were pretty annoying and had different solutions.

First, the problem with the window not closing. This happens when a program is still running when the session tries to close. I found out the program that was left open was teamviewer.exe, the remote support program used on that server. I figured out what was hanging by using Terminal Services Manager--this showed me what programs were still running for that user and I killed each one and waited a few seconds to see if the session closed.

As it happened, all the settings were correct for terminal server as explained on the teamviewer website, but it still hung when I was setting up RDP to run a program and exit.

I found a registry setting under the Teamviewer HKLM hive that was called autostart_gui and changed it from a 1 to a 0. (I couldn't find a place to set that in the teamviewer interface.) Once I set this value to 0, teamviewer wouldn't start when I ran a single program from RDP and thus it wouldn't be around to hang me up. This was OK in my setup because I didn't need teamviewer sessions when RDP sessions are started with a single program. When users are running a full desktop, I also don't need teamviewer running either, as I can still teamviewer in to the console session and then use Terminal Services Manager to see the session desktop.

The second issue was fixed by editing the RDP file I saved. That file is just a text file, so I opened it with notepad and changed the winposstr setting. The values are for starting positions for the window and include the width and height in the 5th and 6th values. So, when my window was sized as 1440 x 900, I needed these settings:


Add 90 to the value for your width and height. Thus, 1440+90 is 1530 and 900+90 is 990.

Once you set these values to 90+ your desktopwidth and desktopheight values, your window will open sized correctly to the value you saved in the RDP settings interface.

Did this help you? You can help me!

Did you find this information helpful? You can help me back by linking to this page, purchasing from my sponsors, or posting a comment!

+One me on Google:

Follow me on twitter:


Affiliation Badges