We help IT Professionals succeed at work.

Creating Folder behind session id # script

Last Modified: 2012-05-11

Our users who log onto our RDP farm (server 2008 r2) are unable to print from i.e 8, they just get a blank page with a file location printed across the bottom.  I know the reason for this, the \Low folder is not being created in the %temp% folder.  After researching I have found this bat fix from microsoft.

Mkdir %TEMP%\Low
Icacls %TEMP%\Low /setintegritylevel Low

If I log onto the farm as a user and run this bat, it works 100% fine and fixes the issues people are having with the printing.  However I want this to automate the procedure as each time they log off that folder is deleted, so I tried a logon script, I also tried a scheduled task in the GPO, as well as trying a folder creation.  None of these work.  Trying to automate the process meant the Low folder is created before the session ID.  

For example

Appdata\Local\Temp\Low\session id number\

However it should be

Appdata\local\Temp\Session id Number\Low

I tried adding a delay to a scheduled log on task of 30 seconds to see if the system needed to assign a session ID # before continuing.  But this does not work either.

Ive tried the following additions to the script..
Mkdir %TEMP%\%SESSIONNAME%\Low (this creates a RDP_TCP#session id folder)
Mkdir %TEMP%\%ID%\Low

All that these do is make a folder called the additions..

I just want to create the Low folder behind the numbered session ID folder!

Any ideas.. assistance ?
Watch Question

not sure if i get this question correctly.

You can get the session Id by using below command..


now, use mkdir to create a folder with the session id number it gives as output in temp..


No I dont think that answers the question at all.  Session ID is assigned at login, I know how to get that information.  I need to make a folder in the user %TEMP% directory behind the session ID named folder it makes when you log on.

As an example ( I've choosen a random number),

User\%USERNAME%\Appdata\local\Temp\  this directory always exists

when the user logs onto any of the RDP farm servers, it creates a folder with a session id in the last directory


I am trying to create the low folder after that session id folder is made, like i said before, if the user clicks the bat file everything works fine, using the cmd above.  However if I prompt the gpo to run this script during login, or set it as a task on a delay of 30 seconds, which I want, it places the low folder in the temp directory and not in the session id folder that is made when the user logs on.  It seems like that folder is made last or something.
Unlock this solution and get a sample of our free trial.
(No credit card required)



Not sure why it works over a script or scheduled task through the GPO but I am not complaining.  

Just fyi.. Starup on Server 2008 is here!
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

Thanks alot man !
you welcome, Did it worked  ?
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.