Setting up users with drives

Posted on 2004-04-16
Last Modified: 2010-04-11
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?

Question by:Peter_Fabri
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
  • 4
  • 3
LVL 57

Expert Comment

by:Pete Long
ID: 10840246
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


Author Comment

ID: 10840578
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.

LVL 16

Accepted Solution

Nyaema earned 300 total points
ID: 10841447
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

LVL 16

Assisted Solution

Nyaema earned 300 total points
ID: 10841721
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

LVL 16

Expert Comment

ID: 10841803
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

Author Comment

ID: 10848820
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?

LVL 57

Expert Comment

by:Pete Long
ID: 10848852
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

Author Comment

ID: 10850307
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.


LVL 57

Assisted Solution

by:Pete Long
Pete Long earned 200 total points
ID: 10850528
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

Author Comment

ID: 10850542
Will the above work for W2K in a domain environment? or is there a different procedure?

LVL 57

Expert Comment

by:Pete Long
ID: 10852560
It will work in a 2K domain, though its traditional to apply login scripts ot an OU level in a domain :)
LVL 57

Expert Comment

by:Pete Long
ID: 10852950

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Changing "From" field - Exchange 2013 5 58
connect to cisco 2690 series 6 76
Strange router problem - can't access 14 109
Citrix App 7 72
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
After creating this article (, I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

752 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