Solved

Setting up users with drives

Posted on 2004-04-16
12
603 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
  • 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I was recently sitting at a desk at work with one of my colleagues and needed some information on my home computer. He watched as I turned on my home computer, established a remote session into it, got the information I needed and then shut it down …
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now