Link to home
Start Free TrialLog in
Avatar of lost_in_data
lost_in_data

asked on

Creating Folder behind session id # script

Hi,

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%\%SESSIONID%\Low
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 ?
Avatar of subhashchy
subhashchy
Flag of India image

not sure if i get this question correctly.

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

qwinsta

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

ASKER

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

User\%USERNAME%\Appdata\local\Temp\12\

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.
ASKER CERTIFIED SOLUTION
Avatar of subhashchy
subhashchy
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
AWESOME!!!!!!!

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  ?