Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to assign Mapped network Drives Per User

Posted on 2011-03-08
Medium Priority
Last Modified: 2012-06-27
Hi All

Im using Windows Server 2003 as a file server in which i want to perform some functions

i have different users in Finance Department
1. Jun
2. Imran
3. Mera
4. April
5. Rizwan
6. Hannah

For each of them i have a shared folder in the server by the same name with appropriate share and security permissions assigned.

Now in AD, all these Users are inside Finance Users OU.. and there is a GPO Assigned to Finance Users OU.. In this GPO i have created a logon script net use z: \\win2k3dc\accounts

This will create a mapped network drive for all 6 users in Finance Department with accounts folder.

Now i want a Y: Drive in their My Computer with their separate Shared Folders..

I cannot find a way how to do that, Of course if i put each in separate OU i can, but i dont want to separate them just for assigning a mapped network drive, please provide solution for this issue.. thank you...

Question by:brandsco
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
LVL 26

Assisted Solution

pony10us earned 1000 total points
ID: 35071226

net use y: \\<share>\%USERNAME%

<share> = the share where the user folder resides

%USERNAME% is the Set variable for the person logged in.

Accepted Solution

8ubterfug3 earned 1000 total points
ID: 35071250
You  can use variables in your script to map a drive based off of a user name. For example... make sure you have your shared folders created and named the same as the user account that will be accessing them. Of course also make sure permissions are set correctly for each. In your script add something like

net use Y: \\server\share\%USERNAME%

If a user has an account like msmith, the Y:\ Drive would map to \\server\share\msmith.
LVL 26

Expert Comment

ID: 35071328

Thank you, I just read my post after looking at yours and noticed that I forgot to include the server in my command.  OOPS!   :)

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

LVL 79

Expert Comment

ID: 35071974
You would need to use a vbscript rather than a simpler batch file.
Using vbscript you can test group membership etc. to assign/map/overlay

The one thing not clear to me is your Y: drive inside the my documents reference.
Are you looking for adding a shortcut to the mapped Y drive inside the my documents folder?

The others covered the use of variables in batch files login/logout files.

The only draw back I see with your implementation deals with the need to create a per user directory within the location or have the Accounting parent directory with full access to the users so that your batch can check whether the directory exists and if not create it prior to mapping the Y: drive.
This would also seem to defeat the purpose of a separate directory which presumably is there to limit what the other users can access.
i.e. have one common location \\server\accountingshare and then have \\server\someothercentralshare\%username% which only the %username% and the Administrators can access.
Do you use folder redirection such that My documents/desktop etc. will be on a server somewhere and will be accessible by the user no matter which workstation they are on?

LVL 26

Expert Comment

ID: 35072060

I understand what you are attempting to say however I think you may have miss-read the original question.

You stated:  "The one thing not clear to me is your Y: drive inside the my documents reference" when in the original quesion was "Now i want a Y: Drive in their My Computer ..."

As for vbscript to test group membership etc. you can do that in batch as well however there was no mention of needing that functionality. It looks like the author is using GPO to control that instead.
LVL 79

Expert Comment

ID: 35072241
pony10us, The person wants a Y: drive in their My documents. The only way to achieve this is by creating a shortcut within the My documents to Y: drive when the Y: drive is mapped.
The Y: drive is not in My documents.

I am uncertain what you intended to correct.

a vbscript as a login script within a GPO provides more flexibility to perform the various tasks.
Presumably if the asker now wants to map drives per user, they will eventually move towards a more complicated scenario i.e. usera, userb who are also members of groupa have to have access to drive Z: as well as have specific printers mapped etc.

The comments you and 8ubterfug3 posted will address the direct question the asker asked, I'm just trying to see whether what they are asking for is in pursuit of a more complex function.

Another option is to use a more power/option reach approach using vbscript/powershell etc.
LVL 26

Expert Comment

ID: 35072362

As stated, I agree with everything you have stated about the vbscropt vs. batch. vbscript/powershell offers more flexibility than batch.

What I was pointing out was that they stated they want the Y: drive in "My Computer" and not "My Documents". In other words, all they want is a mapped drive (Y:) pointed to the share that contains the individuals personal folder.
LVL 79

Expert Comment

ID: 35072927

Author Comment

ID: 35098522
Hi.. Sorry for delayed response.. I have created folders exactly as their domain usernames. But I don't know how to create the set variable to %username% can any one help me on that pls??
LVL 26

Expert Comment

ID: 35098569
The set variable %username% is created when they log into the domain.  If open a command prompt window on a work station and type "set" with out the paranthesises you will get a list of the environment variables in alphabetical order. Near the bottom (usually) you should see USERNAME= and that would be what is returned as %username%

Author Comment

ID: 35136946
Ok. I got it.. I tried it and it really works just fine.. Thank You very much pony10us...

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question