Enable smart sizing in RDP through Remote Desktop Services 2012R2 Web Access

A quick post about a very interesting question from one of our customers: Can you please enable smart sizing when accessing Full Desktops or VDIs which we published using RDS 2012 R2 Web Access?

As you can see in the next screenshot, smart sizing is not available by default when you resize the Remote Desktop Connection window:
27 RDS Web Access Smart Sizing 03
It clearly shows a non-scaled desktop, complete with scroll bars.
I can see how this can be annoying.

And actually smart sizing is really simple to achieve.

As always, backup c:\windows\web\rdweb before making any changes!!

That said, open c:\windows\rdweb\site.xsl in your favorite editor and find line 665 (highlighted in the screenshot):
27 RDS Web Access Smart Sizing 01
(or find that code if you made any modification to site.xsl before)

Insert the following code on that line:

strRdpFileContents += "smart sizing:i:1\\r\\n";

The result must look like this:
27 RDS Web Access Smart Sizing 02
Now save the file, and reload the Web Access page, or open the page, as long as the site.xsl gets re-rendered.

Now when we connect to that same VDI it will still open in full screen mode, but when we resize the Remote Connection Window we can see that with adding just that one line of code we now have smart sizing enabled:

27 RDS Web Access Smart Sizing 04

Like I said, just a quick little post.



20+ years experience in Microsoft powered environments. Enjoy automating stuff using scripts, powershell, and even batch files. In my free time (hah! as if there is any) I hunt achievements and gamerscore on anything Xbox Live enabled (Windows Mobile, Windows 8, Windows 10, Xbox 360 and Xbox One). When I'm not doing that I enjoy traveling or riding my Yamaha R1 on the edge ;)

Tagged with: , ,
Posted in Customize, Remote Desktop, Windows 2012 R2
13 comments on “Enable smart sizing in RDP through Remote Desktop Services 2012R2 Web Access
  1. Ramsy lowes says:

    Very Nice Arjan, thanks.

  2. Eric says:

    Nice find!!
    Thanks for the share

  3. Emil says:

    Hi Arjan,

    I have a question. It is possible to change default screen size(not screen resolution), because if I switch from full screen to window (with smart sizing enabled) my windows is very small and if I resize after logoff window size is smaller again. Thanks in advance.

    • Arjan Mensch says:

      Hi Emil,

      Yes I believe it is.

      Instead of adding the line

      strRdpFileContents += “smart sizing:i:1\\r\\n”;

      Add these lines:
      strRdpFileContents += “screen mode id:i:1\\r\\n”;
      strRdpFileContents += “desktopwidth:i:1280\\r\\n”;
      strRdpFileContents += “desktopheight:i:1024\\r\\n”;

      This will tell the RDP file (which is launched by the ActiveX in WebAccess) to use a non fullscreen session using 1280×1024 (adjust if needed).

      Untested, but taken from a locally saved .rdp file with these settings.

  4. Emil says:


    Is it possible to change default window size(not screen resolution), because if I switch from full screen to window (with smart sizing enabled) my windows is very small and if I resize after logoff window size is smaller again. Thanks in advance

  5. AlektroNik says:

    Hi Arjan, thank you for an excellent article.
    I want to set up automatic replication of all customizations made on the same server Remote Desktop Services 2012R2 Web Access server for all other Remote Desktop Services 2012R2 Web Access.
    Please tell me which folder you want to add a DFS replication?

    • Arjan Mensch says:

      Hi AlektroNik,
      Since modifications usually happen only once in a while, I would not setup DFS but instead would do modifications on a Development server if possible, and simply copy the folder structure to the other web access server(s).

  6. odarchuk says:

    Don’t working for Windows 2016. After editing site.xsl i have error: Error loading stylesheet: Parsing an XSLT stylesheet failed.
    Help me

  7. James says:

    I know this is bit late in the day to ask this, but as we have made a customisation to allow use of multiple Monitors, this smart sizing doesn’t seem to work as expected.

    I find that when shrinking the size of the window, no cropping occurs so the entire session is visible within the newly resized window, but it doesn’t get scaled, it gets squashed.

    I have not yet tried with a single monitor, but I wonder if this a conflict with Multimon?

    • James says:

      Well I downloaded the RDP file via Chrome, removed Multimon option, and it still behaves the same. I guess this functionality is just not quite what I was looking for.

      What I have seen in the past which is what I was hoping for in a way, is if I have an RDP connection created on my work PC with a 1024×768 monitor, lock my machine and go home, then connect remotely to my PC from my laptop with a 4k display, and maximise the existing RDP connection, it detects and automatically adjust the remote session resolution to match the new full screen resolution of my laptop.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog Authors

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 400 other followers

Blog Stats
  • 2,725,603 hits
%d bloggers like this: