0

I've searched for this and found bits and pieces but I think this question would be specific enough that I want to make sure I get it correct.

So what I'm wanting to do us to unify all our different divisions mapped drive letters so every user is using the same drive letter for their own personal drive, how we have the corresponding servers with the drives setup is "\Server\Division\USR\user", I want to create a logon script that would map that path to the specific employee, so when we get new employees, it'd map that for them to their own user folder.

The issue is that all the folders aren't uniform with our current structure of "First.Last', in which case I could do something based on //Server/Division/Usr/First.Last, the old structure was First and then the first letter of their last.

So my question is what would be the ideal way to accomplish this, I'm fairly entry-level with scripting but I've learned enough to do the necessary powershell tasks as an admin but I'm really diving into it lately and am not sure how best to do this so I figured I'd ask it here to see what input could be provided.


Let me also say that the windows login that every employee has is "first.last", so that's the folder structure we're moving to but not everything lines up perfectly so I'm not sure what workaround I can use that maybe would accept wildcards or like statements based around the current windows login..

  • 2
    I'd strongly recommend that you instead try at least a late 90's approach to home folders rather than perpetuate mapping drives. Search for folder redirection. – Jim B Sep 4 '15 at 16:21
  • 1
    I'm a bit confused by the last line. every employee has is "first.last", so that's the folder structure we're moving to but not everything lines up do you mean they might have first.last but their folder path is in your old format? – Drifter104 Sep 4 '15 at 16:43
1

As you seem not to have a uniform structure which would let you derive the directory name by using data available from active directory (especially the user's logon name), you basically have two options at hand:

  1. fix your directory naming scheme and ensure that every user's directory is available as \server\path\logon.name, use environment variables (%USERNAME%) and/or directory lookups to resolve the path as necessary
  2. for every user object, manually set the path you need the user to have mapped in an attribute of the user object, for example:

    ADUC dsa.msc properties profile tab

There are no heuristics guessing the best directory name for a given user. I also would strongly recommend against even trying to implement that - heuristics are going to be wrong occasionally, causing unnecessary disruptions and pointless work for everyone.

Obviously, fixing half-broken things will be hard and painful today, but not fixing them is going to end up even more hard and painful tomorrow.

| improve this answer | |
1

I would use maik's answer on this drive mapping question recommending the use of home folders.

The caveat to home folders is that no other user can access them. This can be good or bad depending on the situation. Having said that, it sounds like it is exactly what you need.

Other than his answer, there are several great options in the same thread.

| improve this answer | |
  • The caveat to home folders is that no other user can access them - this is inaccurate, ACLs on a home folder can be set arbitrarily, although mostly (and by default) access is restricted to the user owning it and administrators. – the-wabbit Sep 5 '15 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.