Remote Desktop Services e Tema Aero

Con Windows 2008 R2 i RDS consentono una User Experience pari a quella di Windows 7 compreso l’utilizzo dei Temi e della Desktop Composition.

Se però la sessione RDS viene avviata impostando un’applicazione d’avvio, il tema non verrà applicato perchè non verrà mai aperto il desktop.

Le soluzioni per impostare il tema in modo che l’applicazione d’avvio possa utilizzare le impostazioni grafiche del tema (per esempio Aero) possono essere tre:

  1. Avviare la prima volta la sessione RDS senza impostare l’applicazione d’avvio per consentire l’applicazione del tema.
  2. Utilizzare uno script di questo tipo per applicare il tema al primo avvio aprendo la dialog dei temi:

    Option Explicit

    Const RegKeyTheme = “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\CurrentTheme”
    Const ThemePath = “%WinDir%\Resources\Themes\”
    Const ThemeFileName = “aero.Theme”

    Dim objShell
    Set objShell = CreateObject(“WScript.Shell”)

    Dim strCurrentTheme
    strCurrentTheme = objShell.RegRead(RegKeyTheme)

    If InStr(LCase(strCurrentTheme),LCase(ThemeFilename)) = 0 Then
      Dim strThemeFile
      strThemeFile = “””” & ThemePath & ThemeFileName & “”””
      objShell.run “Rundll32.exe Shell32,Control_RunDLL Desk.cpl Desk,@Themes /Action:OpenTheme /file:” & strThemeFile, 2
    End If

    Set objShell = Nothing

  3. Importare le chiavi registro necessarie ad applicare il tema che verrà applicato al secondo avvio della sessione:

    regedit /s Aero-ThemeManager.reg
    regedit /s Aero-Themes.reg
    regedit /s Aero-Colors.reg
    regedit /s Aero-WindowMetrics.reg

    *** Aero-ThemeManager.reg ***
    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager]
    “ThemeActive”=”1”
    “LoadedBefore”=”1”
    “LastUserLangID”=”1040”
    “LastLoadedDPI”=”96”
    “DllName”=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\
      74,00,25,00,5c,00,72,00,65,00,73,00,6f,00,75,00,72,00,63,00,65,00,73,00,5c,\
      00,54,00,68,00,65,00,6d,00,65,00,73,00,5c,00,41,00,65,00,72,00,6f,00,5c,00,\
      41,00,65,00,72,00,6f,00,2e,00,6d,00,73,00,73,00,74,00,79,00,6c,00,65,00,73,\
      00,00,00
    “ColorName”=”NormalColor”
    “SizeName”=”NormalSize”

    *** Aero-Themes.reg ***
    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes]
    “ThemeChangesDesktopIcons”=dword:00000001
    “ThemeChangesMousePointers”=dword:00000001
    “LastHighContrastTheme”=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,\
      6f,00,6f,00,74,00,25,00,5c,00,72,00,65,00,73,00,6f,00,75,00,72,00,63,00,65,\
      00,73,00,5c,00,45,00,61,00,73,00,65,00,20,00,6f,00,66,00,20,00,41,00,63,00,\
      63,00,65,00,73,00,73,00,20,00,54,00,68,00,65,00,6d,00,65,00,73,00,5c,00,68,\
      00,63,00,62,00,6c,00,61,00,63,00,6b,00,2e,00,74,00,68,00,65,00,6d,00,65,00,\
      00,00
    “InstallVisualStyle”=hex(2):25,00,52,00,65,00,73,00,6f,00,75,00,72,00,63,00,65,\
      00,44,00,69,00,72,00,25,00,5c,00,74,00,68,00,65,00,6d,00,65,00,73,00,5c,00,\
      41,00,65,00,72,00,6f,00,5c,00,41,00,65,00,72,00,6f,00,2e,00,6d,00,73,00,73,\
      00,74,00,79,00,6c,00,65,00,73,00,00,00
    “InstallVisualStyleColor”=”NormalColor”
    “InstallVisualStyleSize”=”NormalSize”
    “InstallTheme”=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\
      00,74,00,25,00,5c,00,72,00,65,00,73,00,6f,00,75,00,72,00,63,00,65,00,73,00,\
      5c,00,45,00,61,00,73,00,65,00,20,00,6f,00,66,00,20,00,41,00,63,00,63,00,65,\
      00,73,00,73,00,20,00,54,00,68,00,65,00,6d,00,65,00,73,00,5c,00,62,00,61,00,\
      73,00,69,00,63,00,2e,00,74,00,68,00,65,00,6d,00,65,00,00,00
    “CurrentTheme”=”C:\\Windows\\resources\\Ease of Access Themes\\basic.theme”
    “SetupVersion”=”10”
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\DefaultVisualStyleOff]
    “InstallVisualStyle”=hex(2):00,00
    “InstallVisualStyleColor”=”Windows classico”
    “InstallVisualStyleSize”=”Normal”
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\DefaultVisualStyleOn]
    “InstallVisualStyle”=hex(2):25,00,52,00,65,00,73,00,6f,00,75,00,72,00,63,00,65,\
      00,44,00,69,00,72,00,25,00,5c,00,74,00,68,00,65,00,6d,00,65,00,73,00,5c,00,\
      41,00,65,00,72,00,6f,00,5c,00,41,00,65,00,72,00,6f,00,2e,00,6d,00,73,00,73,\
      00,74,00,79,00,6c,00,65,00,73,00,00,00
    “InstallVisualStyleColor”=”NormalColor”
    “InstallVisualStyleSize”=”NormalSize”

    *** Aero-Colors.reg ***
    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Control Panel\Colors]
    “Background”=”0 0 0”
    “Scrollbar”=”200 200 200”
    “ActiveTitle”=”153 180 209”
    “InactiveTitle”=”191 205 219”
    “Menu”=”240 240 240”
    “Window”=”255 255 255”
    “WindowFrame”=”100 100 100”
    “MenuText”=”0 0 0”
    “WindowText”=”0 0 0”
    “TitleText”=”0 0 0”
    “ActiveBorder”=”180 180 180”
    “InactiveBorder”=”244 247 252”
    “AppWorkspace”=”171 171 171”
    “Hilight”=”51 153 255”
    “HilightText”=”255 255 255”
    “ButtonFace”=”240 240 240”
    “ButtonShadow”=”160 160 160”
    “GrayText”=”109 109 109”
    “ButtonText”=”0 0 0”
    “InactiveTitleText”=”67 78 84”
    “ButtonHilight”=”255 255 255”
    “ButtonDkShadow”=”105 105 105”
    “ButtonLight”=”227 227 227”
    “InfoText”=”0 0 0”
    “InfoWindow”=”255 255 225”
    “ButtonAlternateFace”=”0 0 0”
    “HotTrackingColor”=”0 102 204”
    “GradientActiveTitle”=”185 209 234”
    “GradientInactiveTitle”=”215 228 242”
    “MenuHilight”=”51 153 255”
    “MenuBar”=”240 240 240”

    *** Aero-WindowsMetrics.reg ***
    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]
    “BorderWidth”=”-15″
    “CaptionFont”=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
      00,00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
    “CaptionHeight”=”-315″
    “CaptionWidth”=”-315″
    “IconFont”=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\
      00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
    “IconTitleWrap”=”1”
    “MenuFont”=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\
      00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
    “MenuHeight”=”-285″
    “MenuWidth”=”-285″
    “MessageFont”=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
      00,00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
    “ScrollHeight”=”-255″
    “ScrollWidth”=”-255″
    “SmCaptionFont”=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,\
      00,00,00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
    “SmCaptionHeight”=”-255″
    “SmCaptionWidth”=”-255″
    “StatusFont”=hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
      00,00,00,01,00,00,05,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
    “Shell Icon Size”=”32”
    “AppliedDPI”=dword:00000060
    “PaddedBorderWidth”=”-60″
    “IconSpacing”=”-1125″
    “IconVerticalSpacing”=”-1125″

Per ulteriori spunti e informazioni si veda How to change Windows Theme programmatically in XP.