Solved

Setting up users with drives

Posted on 2004-04-16
12
645 Views
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?

Peter
0
Comment
Question by:Peter_Fabri
[X]
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
12 Comments
 
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

OR

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

Pete
0
 

Author Comment

by:Peter_Fabri
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.

Peter
0
 
LVL 16

Accepted Solution

by:
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

\\ServerName\SharedFolder\%UserName%

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

0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 16

Assisted Solution

by:Nyaema
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



0
 
LVL 16

Expert Comment

by:Nyaema
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
0
 

Author Comment

by:Peter_Fabri
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?

Peter
0
 
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
0
 

Author Comment

by:Peter_Fabri
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 Use /PERSISTENT:NO > NUL

Net time \\server /set /yes

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

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

etc


Echo Thanks for your patience !!

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

Peter

0
 
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
0
 

Author Comment

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

Peter
0
 
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 :)
0
 
LVL 57

Expert Comment

by:Pete Long
ID: 10852950
ThanQ
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), 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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses
Course of the Month5 days, 23 hours left to enroll

626 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