Map drive by username variable in Group Policy

H2Omike used Ask the Experts™
I want to use group policy to map user drives specific to each user.  Such as:  username domainname\peteh needs to map to \\servername\peteh$

Is there a way to do this via group policy?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
Use a login script
Within which you can have
net use h: \\servername\%username%

what is the variable, username?

You could use %username% in gpp.
H2OmikeIT Manager


Variable is the username they log in as.  The mapped drive would be \\servername\username$

I tried the attached in GPP but it doesn't work.
H2OmikeIT Manager


Also, how do you map based on group membership?  Like if in group HR, map \\servername\hr$?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

groups are easy, goto common tab and item level targeting

you can do username there too, but I doubt you want a policy for each user.

also make your your user drive is running in their security context
Distinguished Expert 2017

You either create a GPO per mapped drive using the security filtering I.e GPO map drive A security filter members of groupa
GPO groupB shared drive security filter groupB

The other is to use a single logins vbscript/powershell script that has drive mapping a which includes verification of group membership as a condition.  There are examples of vbscript said, powershell and batch scripts tart conditionally map drives.

The script would either obe part of the GPO or the login script under the user's AD profile using netlogon  script.

are you mapping drive letters.

E: he
F: management
Hi H2OMike,
This is how I map home drives. I actually use the profile method for domain users, with a share created for where I keep all of the user directories. I have to manually enter this each time I create a new user, when I create the AD user I add the profile home drive path. There is a script in here and has been mentioned by others that looks like you can create them automatically. I hope this helps.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial