How to Set the Monitor for a Remote Desktop Session in a Multi-Monitor Setup

How to Set the Monitor for a Remote Desktop Session in a Multi-Monitor Setup

If you have multiple monitors, you may want to have the Remote Desktop Session for a particular computer always appear on the same monitor. Unfortunately, the Remote Desktop Connection user interface does not expose a setting like "Display Session on Monitor X." There is a way to do this, but it is neither easily discoverable nor intuitive. This article shows you how to configure a saved remote desktop connection so that sessions to a particular computer always appear on the monitor that you choose.
 
The Default.rdp file
By default, remote desktop saves the settings for a remote desktop session in a file called Default.rdp. In Windows 7, Default.rdp saves by default to the %homedrive%%homepath\Documents directory.
 
You can edit this file by right clicking it and selecting Edit. The Remote Desktop Connection dialog that appears has a Display tab. This tab allows you to choose the resolution for the session, and even has a checkbox called Use all my monitors for the remote session, but there is no option to choose a particular monitor for a remote session if you want to use just one monitor.
 
Save a Separate .rdp File for Each Remote Computer
 
The first step is to save and keep a separate remote desktop configuration .rdp file for each computer that you want to access remotely.
 
To save a separate .rdp file:

 1. Open the Remote Desktop Connection dialog. In Windows 7, one of the easiest ways to do this is to click Start, type "remote" in the Search programs and files box, and click the Remote Desktop Connection icon that appears in the search results. 

2. In the Remote Desktop Connection dialog, enter the name of the computer to which you will connect.
 
3. Click the Options button in the lower left corner. This will reveal a Save As button.
 
4. Save the file with a name that you will easily recognize, preferably with the name of the computer itself.
  In Windows Explorer, use Notepad or other text editor to open the.rdp file that you saved. Right-click the file, and instead of choosing Edit, choose Open with, and select Notepad. If necessary, navigate to %windir%\System32 directory, and select Notepad.exe.
 
Analyzing the .rdp File
 
The .rdp file contents will look like this:
 
screen mode id:i:2
use multimon:i:0
desktopwidth:i:1680
desktopheight:i:1050
session bpp:i:32
winposstr:s:0,1,-1680,0,-115,1050
[….]
 
Look for the keyword winposstr. The most important parameters are the numbers after winposstr. Ignore the initial ":s:0,1," and focus on the last four comma-delimited numbers.
 
The last four numbers express, in pixels, the position of the left, top, right, and bottom edges of the remote session window.
 
The numbers actually refer to the window position when the window is restored, but the pixel position of the left edge of the window is important because it also determines the monitor that the remote session will use when the window is maximized.
 
Calculating the Values for winposstr
 
The numbers that you will use depend on how many monitors you have, the screen resolutions of each, and which monitor you have selected to be your primary monitor.
 
Left edge position determines the monitor
 
The first of the last four numbers, which is the most important, indicates the position of the left edge of the window. If your primary monitor is in the center and you have monitors to the left and right, you will use a negative number for the monitors to the left, and a positive number for the monitors to the right.
 
For example, if you have two monitors to the left that each have a resolution of 1680 x 1050, use -1680 to place the session window on the monitor to the immediate left, and double that (-3360) to place the window on the leftmost monitor.
 
winposstr:s:0,1,-1680,0,0,1050
 
winposstr:s:0,1,-3360,0,-1680,1050
 
If your primary monitor has a resolution of 1200 x 1920, use 1200 to place the window on the monitor on the immediate right. This works because that pixel position is where the primary monitor leaves off (and the monitor on the right begins).
 
winposstr:s:0,1,1200,0,2880,1050
 
If you have two monitors on the right with a resolution of 1680 x 1050, and want to place the window on the rightmost monitor, simply add 1200 to 1680 to get 2880.
 
winposstr:s:0,1,2880,0,4560,1050
 
 
Top and Bottom Edges
The other numbers only really come into play when the window is restored (not maximized) and can be adjusted to taste.
 
The second number (third from the end) indicates the topmost edge of the window, so you can leave this number at 0 unless you have special requirements. The fourth (last) number is the vertical resolution (=bottom) of the window. You can leave this at the maximum vertical resolution of the monitor, as in the examples above.  
 
winposstr:s:0,1,1200,0, 2880,1050
 
Right Edge
The right edge of the window is expressed by the next to the last number. Unless you prefer otherwise, this can be set to the same size as the maximized window. Following the monitor resolution examples above, here are the calculations:
Monitor Right Edge Calculation   Winposstr Value
Leftmost -3360 + 1680 = -1680 winposstr:s:0,1,-3360,0,-1680,1050
Immediate left -1680 + 1680 = 0 winposstr:s:0,1,-1680,0,0,1050
Immediate right 1200 + 1680 = 2880 winposstr:s:0,1,1200,0,2880,1050
Rightmost 1200 + 1680 + 1680 = 4560 winposstr:s:0,1,2880,0,4560,1050
 

 

 

Fortunately, RDP remembers the number for the left edge of the restored window and positions the maximized window based on that. Because of this, after you set the "restored window" winposstr values as in the examples above, you can use the .rdp file to open a session in a maximized state, and the window will appear in the position (and therefore on the monitor) that you have set.
 
Configuring the Remote Session to Always Open Maximized
 
To have the remote session always open in a maximized window, you can either use the Remote Desktop Connection dialog, or edit the .rdp file directly. To use the Remote Desktop Connection dialog, click the Display tab and set the Display configuration to Full Screen. To edit the the .rdp file directly, set the screen mode id value to 2, as in the following example.
 
screen mode id:i:2
 
If for some reason the remote desktop session does not fill your screen when maximized, you can manually set the maximum screen size by manually modifying the desktopwidth and desktopheight parameters in the .rdp file. For example, this will set the resolution to 1680x1050:
 
desktopwidth:i:1680
desktopheight:i:1050
 
Using the Edited.rdp File
 
To launch a remote session based on your edited .rdp file, you can double click it in Windows Explorer or use the Remote Desktop Connection dialog to browse to the file and open it (from the dialog, click Options, then Open), but you may find it more convenient to just create a shortcut to the .rdp file and place the shortcut on your desktop where you can access it immediately.
 
 
Leave a Comment
  • Please add 3 and 4 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 7. Comment: Modified title casing, added tag

  • Fernando Lugão Veltem edited Revision 6. Comment: remove en-us from title

Page 1 of 1 (2 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Thanks much for a lucid and (mostly) complete explanation. Only the ":s:0,1," parameters are glossed-over.

    This gives me a usable workaround - though still not quite a solution - for my "windows-7 remote-desktop doesn't remember last position" issue.

    PS:

    I've seen this technique - likely from this very post - referenced elsewhere, and I'm surprised that it's taken almost 2 years for someone to thank you.

  • Secondly, a note to M$ developers re "remembering last screen-position":

    It's true that a problem can be caused by the client changing screen resolution between sessions, thereby making the remembered position off-screen. Two aspects of this issue come to mind.

    1 It applies to any remembered screen-position, not just Remote Desktop;

    2 The fix is easy: "ScrollIntoView". I believe there's a suitable winAPI-call. If not, it shouldn't be too hard to build using Math::Min(), Math::Max(), screen-size, window-position and window-size.

    Thanks again for a welcome post, and welcome to my bookmarks.

  • VERY HELPFUL!  THANK YOU!

    Though this did not *start* my window in another monitor, as I hoped, it did set the Remote Desktop windows dimensions *even when maximized*.  In my case, after double-clicking my edited "M3.rdp", I manually move it to the correct monitor, then <ctrl>-<alt><break> to maximize the window to that monitor's desktop.

    ((Sometimes, using <ctrl>-<alt>-<break> to maximize Remote Desktop does not leave the window area *edges* clickable.  If that happens, disconnect and reconnect a second time:  you get the edges after reconnecting.))

    In my situation, this dimension control made a big difference:  I'm using my 32" HDTV as a 3rd monitor, connected thru the HDMI port (for better resolution than VGA).  Unfortunately, the TV only lets me control its horizontal and vertical *stretch*, for its "PC" input -- not its HDMI input.  So, all window edges were invisible, when Remote Desktop was maximized.

    Now, after editing the RDP settings file, I can see all edges -- EVEN WHEN MAXIMIZED.

    In my example, the ORIGINAL settings were:

    screen mode id:i:1

    desktopwidth:i:1280

    desktopheight:i:768

    session bpp:i:32

    winposstr:s:2,3,519,0,1758,600

    and the EDITED settings are:

    screen mode id:i:1

    desktopwidth:i:1800

    desktopheight:i:978

    session bpp:i:32

    winposstr:s:2,3,419,-1900,2278,810

    So, since 520 was added to "desktopwidth" (1280+520=1800),

    520 was also added to the 2nd to last parameter in "winposstr" (1758+520=2278).

    And, since 210 was added to "desktopheight" (768+210=978),

    210 was also added to the last parameter in "winposstr" (600+210=810).

    ((As I said before, I took the principles of a "monitor to the left" or "monitor to the right", and tried applying them to a "monitor" above... using the -1900.  That's not working... but the dimensions were a big deal (thanks!), and two clicks to move it to that monitor is no big deal.))

    Good luck!

  • Fernando Lugão Veltem edited Revision 6. Comment: remove en-us from title

  • Richard Mueller edited Revision 7. Comment: Modified title casing, added tag

  • Thanks a lot. You have definitely reduced the amount of grey hairs I've been growing lately.

    Workjing with three monitors and several rdp sessions daily.

Page 1 of 1 (6 items)