Wednesday, November 29, 2017

Temporary Directories for RDP sessions on windows

By default, In windows server machines, when you login to the machines using Remote Desktop Session, it will create a temporary sub directory in the temp folder and redirects to this when we tried to access temp folder using %temp%
1
As you see the number marked at the end.
2
We can disable this behavior using the below setting in group policy.
For server 2003:
group policy:  Administrative Templates\Windows Components\Terminal Services\Temporary folders . If you don’t select Do not use temporary folders per session, then these TEMP subdirectories are created.
For server 2008 and above:
group policy:  Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Temporary folders
3

The following tool, from Microsoft TechNet, allows management of Group Policy via the command line, and thus scripting as well:

The registry used is:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]
“PerSessionTempDir”=dword:00000000

No comments:

Post a Comment