jbailey Posted February 1, 2014 Posted February 1, 2014 Hello, i'm not really a scripting\coding person, I just put ticks in the right boxes all day So I was hoping someone could help me with something I am trying to do on a windows network, I have a server path: \\server\share\AUSER\files Where the AUSER can be different users each with a folder in that location. I want to create a mapped drive to that location, so can use net use D: \\blah... but, is there a way I could get the %username% of the logged on user and insert that into the \\ path to replace AUSER before mapping it as: \\server\share\NOAREALUSER1\files etc? Any help appreciated thank you.
IWDave Posted February 1, 2014 Posted February 1, 2014 In a login script try: Net use d: "\\server\share\%username%" Sent from my iPad using EduGeek 1
jbailey Posted February 1, 2014 Author Posted February 1, 2014 Hello, Thank you, but I need to find a way to insert the username into the middle of the path like: \\server\files\"unique username here"\files. So i'm thinking, something that gets the %username%, then concatenate the path around the username, then use the new unique path for the net use bit...
IWDave Posted February 1, 2014 Posted February 1, 2014 The principle is the same Net use d: "\\server\share\%username%\files\" As far as I can remember at this time in the morning after a night out, this should work. Sent from my iPad using EduGeek
jbailey Posted February 1, 2014 Author Posted February 1, 2014 lol, you and me both... Of course that would work - Doh thanks very much
IWDave Posted February 1, 2014 Posted February 1, 2014 Just to confirm the following string %username% is the actual command used to retrieve that information about who the user is. Just thought I'd clarify that. Sent from my iPad using EduGeek
IWDave Posted February 1, 2014 Posted February 1, 2014 lol, you and me both... Of course that would work - Doh thanks very much :-) Sent from my iPad using EduGeek
p858snake Posted February 2, 2014 Posted February 2, 2014 What server environment are you running this on? There may be a better way to do this.
jbailey Posted February 5, 2014 Author Posted February 5, 2014 hi, win 2008 r2 I had some luck creating separate variables and concatenating them together to form unique paths based on their %username%, this works for what I need, but I am sure there's smarter ways to do this. thanks
sonofsanta Posted February 5, 2014 Posted February 5, 2014 2008R2, you can use Group Policy Preferences to do it ( User Config > Preferences > Windows Settings > Drive Maps). Use the %username% variable still to do something like: Action: Update Letter: D Location: \\server\share\%username%\files Label as: User Files etc. If you're not familiar with scripting it may be easier for you to read/diagnose issues going forward.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now