Discussion Locked

Login script to map personal drive

0 helpful
15 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

We run NT4 (moving to Win2k) servers with some NT4, Win2k, but mostly Win95 clients. I'm not a network guru, but those who are tell me that there is no way to write a generic login script that will automatically map a user's private share. They tellme a script can't read the user's machine name in Win95 (which is the same as their username), and place that in a variable to map to \\servername\$ They tell me we'd need to hand-write a script for each user.

While I'm no MCSE, I find it hard to believe that this is impossible. Please prove me right.

15 replies

by tmaclennan

I'm not an MCSE either, but if you define a home directory for each user under the Profiles setting in User manager, you can include the following line in the login script:
Net Use M: /Home

by esrfalco

Thanks, but I was hoping for a generic DOS batchfile line that would grab the login name of a Win95 client and make that a variable to map a private drive (e.g., net use R: \\servername\%loginname%$).

by jdow

The net use command has a parameter /HOME that MS says only works with NT but that is not true. Take this example. NET USE H: /HOME /YES, would look at the user accounts' defined home directory (In user manager), and then map appropriately. The only draw back (Which is the same no matter what) is you need to create a share and set permissions for each user directory. (NT does not have the ability to map to a folder that is not a share - Unlike Netware).

Jason

by esrfalco

Thanks, but I was hoping for a generic DOS batchfile line that would grab the login name of a Win95 client and make that a variable to map a private drive (e.g., net use R: \\servername\%loginname%$).

by avachon

Hi, if you want to use only a simple logon script using the net use command, then your friends are right. The %username% variable works with nt workstations. However, you may want to look into perl or wsh (windows scripting host).

by jason.barnett

I am not sure of the environment variable set in Windows '95. I do know that under NT4 if you use the following:

net use k: \\server1\%username%$ you will have a drive mapped to the hidden username share.

if this does not work in '95, why notset the home directory variable in the profile settings of the user account in user manager? the only limitation to this is that you can't user %username%$ in this field, you can only use %username%

hope this helps.

by esrfalco

Thanks, but I was hoping for a generic DOS batchfile line that would grab the login name of a Win95 client and make that a variable to map a private drive (e.g., net use R: \\servername\%loginname%$).

by rraheb

You don't have to do it through a logon script. I don't think that there is a generic login script that can does this job for you.

Here is what you can do :
-------------------------

You'll have to do this setup once for all of your existing users and then for new users make sure that it is done whenever the user is created.

From the user manager for domains, select the user and then set the path & drive assignment for his home folder. It will automatically be mapped when the user logs in without the need for a script.

Hope this helps you out.

Rafik El-Raheb.

by networkmunchkin

You are undeniably correct.
My recommendation is to use Kixtart. It's a script language that is VERY functional when it comes to login scripts. You can do virtually anything you want with it. It has macros that can determine username, pc name, group memberships, time of day, your mom's shoe size, and just about anything else you could possibly want to know about who is logging on, when, and where.
Even better yet... kixtart is just as simple to write in as regular NT batch file language.The manual has tons of examples for each command you can customize you your needs.
Regarding mapping a private share based on who is logging in... it's very simple.
It's a matter of setting up a basic "use" command to map the drive, and thenreplacing certain values in the UNC with macros that derive the userid that is logging in, and also the hostname of the PC they're on at the time if you really want. The machine name is irrelevant though since you'll want the user to get his privateshare even if they log into multiple machines.
All you really need is to already have standard naming convention for your private share names. Basically... each private share needs to match up to each username in some common fashion so that youcan isolate a specific section of the command line and make it into a variable.

ie. user: billybob share: \\server\billybob$

command-> use h: "\\server\" +@userid+ "$"
which translates to:
use h: "\\server\billybob$"

That makes one single command that will work for all users, based on determining their username during the login process.
It works.

Look into it. I guarantee you can make Kixtart work for you. Download Kixtart v3.63. It's free.

http://kixtart.org

(Also, no I'm not working for the kixtart people, and no I don't have any programming background at all. I honestly like it and have used it to make numerous complicated scripts.)

by networkmunchkin

Oh ya...one other thing... Kixtart commands will function in all versions of Windows... 95, 98, NT, ME, and 2000, and whatever else they come out with.
Some of the more complicated stuff (ie. registry editing) has to be customized per OS, but simple mapping and such is all the same.

by networkmunchkin

And if you have problems because the private shares dont happen to follow a standard formula... you can use "if" statements"
ie.
if @userid = "billybob"
use h: "\\server\billybob"
endif
if @userid = "john"
use h: "\\server\johnhome"
endif

All in one script......

This discussion is closed to new replies.