Setting up users with drives

I think I can set up server drives so that my workstation can see them when logged on as a user. Is there a more efficient way of setting up a folder for each user by using %username% as a parameter so that when each user logs on to my workstation, they see their private/shared drive?

Who is Participating?
Joseph NyaemaIT ConsultantCommented:
Assuming you are using Windows 2000 Server.

With Active Directory Users and Computers
In the Properties of the users-> Profile Tab

Enter the following for the Home folders Fields
Select the Connect Button which in turn automatically selects z: by default and the Mapped drive for the user.
In the To field enter


Where ServerName is the name of your server
SharedFolder is the share on your server you have assigned to be used for storing user files.  Make sure this share exists before you start this operation the share name is normally "Users"
%UserName% is a variable.  This will automatically be replaced by the users login name.

When you click OK,  The system will automatically create a folder in the Shared Folder using the users name and give exclusive access rights to that user only.

If you are using Windows NT/2K/XP, when the user logins the system will automatically map drive Z: to the home folder stated in Home Folder properties for that user in active directory.

Logging in to a Windows 9x machine has the effect of creating a roaming user profile.
Then you would have to create a batch file that maps the drive to the Shared Folder.

Net Use z: \\ServerName\SharedFolder

Pete LongTechnical ConsultantCommented:
Yes you need to put

IF NOT EXIST h: then net use h:\\server\share /y
IF NOT EXIST h:\%username% then MD h:\%username%

in your login scripts

This will map drive letter H to the users home drive (called their username)

You can run a batch file at either Startup or shutdown (or Logon/Logoff) from the Local Security Policy

CLick Start >Run > type "gpedit.msc" {enter}

Navigate to the following location

Local Computer Policy >Computer Configuration >Windows Settings >Scripts


Local Computer Policy >User Configuration >Windows Settings >Scripts

In both locations you will see a set of scripts in the USER settings you set scripts for LOGON and LOGOFF. In the COMPUTER settings you will see scripts for STARTUP and SHUTDOWN

Add your .bat file to the appropriate script.

Or if you have a DOMAIN you can put it in the Domain login script

Peter_FabriAuthor Commented:
I'm a bit confused about script and .bat files. How do they differ and how important are they?

Can I easily access my script files, say from the OS? I know a path was outlined above, but this seems to suggest I need to be in the command prompt rather than the OS.

My server is a domain controller, if this makes explaining any easier. Also, is there a format this files must have?

Sorry if I'm being a bit dense here, but it's the first time i am doing this sort of thing at home.

Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

Joseph NyaemaIT ConsultantCommented:
PeteLong's Solution assumes that you are not in a Domain Environment.
A Domain Environment makes things much easier.

You can create a batch file using notepad and save the file as MapHome.bat

Net Use z: /delete /y
Net Use z: \\SernverName\ShareName /y

Save the batch file in the share \\ServerName\NetLogon on the Domain Contoller
or in the shared folder c:\WinNT\SysVol\FQDN\scripts on your domain Controller.  This folder is shared as NetLogon

where FQDN is the fully qualified domain name for your DS.

You could also use a VB script to do the same thing and store it in the NetLogon share as MapHome.vbs

Dim WshNetwork
Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.RemoveNetworkDrive "Z:"
wshNetwork.AddNetworkDrive "Z:", "\\Servername\ShareName", bUpdateProfile

Joseph NyaemaIT ConsultantCommented:
Once the you have saved the script in the NetLogon directory.

Enter the  name of the Batch file or Script in the Logon Script field on the Profile Tab of the users properties in active directory
Peter_FabriAuthor Commented:
What is the "y" for in the above batch file? I have created a MapHome.Bat file and saved it in the shared folder c:\WinNT\SysVol\scripts in my domain Controller and then entered the name of this file in the Logon script field on the Profile tab of one of my users. What should I now expect to see?

Pete LongTechnical ConsultantCommented:
if you mean the /y on the end of the net use command it meane "Persistent" i.e. the mappint will be there after a reboot
Peter_FabriAuthor Commented:
I still need some clarification. The advice above regarding creating a batch file, is that all the commands I need? And should I be naming the files after the  users rather than MapHome.bat in the logon script field?
Looking at some example .bat files, one begins

@echo off


Net time \\server /set /yes

Echo connecting drives please wait........
@echo off

Net use p:\\server\user$
net use g:\\server\public  


Echo Thanks for your patience !!

I should be most grateful if further help and explanations could be offered regarding batch files.


Pete LongTechnical ConsultantCommented:
You want to set time as well?
@echo off                                  <---------------stops it writing to the screen
IF NOT EXIST h: then net use h:\\server\share /y                 <---------------------looks to see if H drive exists if it DOSNT it maps it persistantly
IF NOT EXIST h:\%username% then MD h:\%username%     <--------------------looks in the above location to make sure there is a folder called %username%
net time /setsntp:<IP address of server>                              <--------------------sets the clients time to a servers time
Peter_FabriAuthor Commented:
Will the above work for W2K in a domain environment? or is there a different procedure?

Pete LongTechnical ConsultantCommented:
It will work in a 2K domain, though its traditional to apply login scripts ot an OU level in a domain :)
Pete LongTechnical ConsultantCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.