[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1013
  • Last Modified:

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 ?
0
lost_in_data
Asked:
lost_in_data
  • 3
  • 2
1 Solution
 
subhashchyCommented:
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..
0
 
lost_in_dataAuthor Commented:
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.
0
 
subhashchyCommented:
how about putting the script in to startup folder of all users. instead of running through GPO or startup script
0
 
lost_in_dataAuthor Commented:
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 !
0
 
subhashchyCommented:
you welcome, Did it worked  ?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now