Terminal Services PerSessionTempDir setting on Windows Server 2008 RRS feed

  • Question

  • In previous versions of Windows that support Terminal Services, it seems that when 'PerSessionTempDir' is enabled it would create a subdirectory with the hex value of the session id. ie. If a user logged into session 10, their temp folder would be under 'C:\Users\User01\AppData\Local\Temp\a\'.

    In Windows Server 2008, this seems to have changed. Instead of it being in hex, it seems to use
    the decimal representation. ( ie. 'C:\Users\User01\AppData\Local\Temp\10\' ) Is there a way for a process running outside of the user's session to determine what the user's temporary directory is?

    Here is a small explanation as to why this issue has been encountered and why GetTempPath() API cannot be used. We need our small program to start up on session creation, so we've placed it in the 'HKLM\System\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\StartupPrograms' key. The problem is that when run from this location, it seems the users profile has not initialized and GetTempPath() api will throw back the temp directory without the session id. ( ie. '
    C:\Users\User01\AppData\Local\Temp\' )


    • Edited by happo2000 Tuesday, October 30, 2018 1:15 PM
    Friday, September 12, 2008 8:40 PM