OReg.GetBinaryValue strMainPath,strKeyPath,_ StrEntryName = “ItemPos” & hRes & “x” & vRes & “(” & numberMonitors & “)” ‘Force refresh on screen to create/update itempost registry item StrNewEntryName = “ItemPos” & hRes & “x” & vRes & “(” & numberMonitors & “)” Set oExec = WshShell.Exec(strGetSystemMetrics & ” 0″) Set oExec = WshShell.Exec(strGetSystemMetrics & ” 1″) Set oExec = WshShell.Exec(strGetSystemMetrics & ” 80″)ĭo While True Set oReg = GetObject(“winmgmts:\\.\root\default:StdRegProv”)Īction = colNamedArguments.Item(“Action”) Set WshShell = WScript.CreateObject(“WScript.Shell”) StrGetSystemMetrics = “D:\Scripts\SystemMetrics\GetSystemMetrics.exe” StrKeyPath = “Software\Microsoft\Windows\Shell\Bags\1\Desktop” Now it’s possible the easily script the whole thing:
At logon I want to do the same but only use the temporary key to create or overwrite the current key with the resolution and number of monitors. I want the script to detect the current resolution and number of monitors to copy the desktop position settings to a temporary key on the same location at logoff. Be sure to allow excution of this executable when application security is enabled in RESWM. You can also use the RES Custom Resources to deploy the files to your server. I placed the GetSystemMetrics.exe on the local drives of the Xenapp servers to speedup the logon.
The solution is a smart tool created by CleverIT to access the Windows API without creating holes in your security or overload your servers. Using Excel to workaround this issue causes load on you server and delays the logon. Not everyone want to do this… The other option is to use a Windows API but the vbs security won’t let you do this. You can use WMI to collect data from the session but therfore the user has to be a read only administrator in Xenapp. The only problem is that you cannot easily detect the resolution in a RDP session. It’s much more easier to detect the resolution at logon and copy the last settings. RES Support gave me the workaround to prepopulate several resolutions as keys wich, in some circumstances, solve the problem. When logging on again with a resolution used before all the icons a placed back to default again. Not only the desktop icons are placed default when logging on but also the desktop.pos gets new values which are loaded at logon. When you logon to a new configuration it creates a new key when you changed the position of the desktop icons and hit the refresh button or log off. Step 2: Dealing with different monitor configurationsĪs stated the Itempos key is created per resolution and number of monitors. You can apply this during logon or log off for new or existing users. SetACL.exe -on “HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop” -ot reg -actn ace -ace “n:%USERNAME% p:delete m:deny” This can be easily done using SetACL from Helge Klein ( ): Knowing all this a solution is easy: Deny the user to delete the key to keep the values. The keys are created, modified and deleted in the user context. When changing the position of the icons the registry key is created during a refresh of the desktop or log off. This places all the icons in the default position. This key holds the information on the items (more information )įor some reason these keys are deleted from the registry during logon. HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop RESWM tries to override/recreate the settings held in the registry key but failes for some reason. RESWM also manages the desktop icon positions in the personal desktop.pos file. This is because of the registry setting involved which Microsoft screwed up. The default behaviour is that the icons are reset when the resolution changes. While investigating the problem I discovered that a regular RDS session doesn’t have this problem and also Citrix Xenapp works perfectly. Step 1: Block the deletion of the registry key The second step is dealing with users who having different resolutions and number of monitors. This solves the problem when a user uses the same resolution and number of monitors on different devices. The first step to take is to block the deletion of the registry key. Solving this problem can be done in 2 steps. When a mandatory profile is used RES has a solution to apply and is available at the support site or by contacting support. Users have a roaming profile to keep their settings. We’re using Windows Server 2003 with Xenapp 5 and RES Workspace 2011. Although this isn’t a big drama I can imagine that it can be quite annoying. Using RES Workspace Manager our users discovered that their desktop icons aren’t remembered at logon when the change their positions.