Solved

Setting up users with drives

Posted on 2004-04-16
12
640 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remote access problem to camera controller 9 66
Vyos VLANs 14 55
Reset HP V1905-24-PoE switch to factory default settings 2 36
WDS can't PXE boot 3 26
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
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…

679 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