Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logon Script Help

Status
Not open for further replies.

volv

Technical User
Sep 21, 2003
19
0
0
GB
Hi there, i have had a recent request to set up a logon script for users within a Windows 2000 domain which will

a) map their computers to their home directories on the server and set up printers ,etc.

b) Synchronise their my documents on their c: drive to a location on their home directory on the server everytime they log on.

does any one either know how to do this or can someone suggest a good resource where i can learn about doing this.

many thanx
 
I had to do something similar. The user name everyone used was their first initial and then last name. Clint Eastwood would be "ceastwood". There home directory was named the same, "ceastwood". This is what I put into the .bat file to get the user name.

@echo off
start /w /m regedit /e reg.txt HKEY_LOCAL_MACHINE\System\CurrentControlSet\control
type reg.txt | find "Current User" > "Current#User.bat"
echo set CurrentUser=%%1>"Current User.bat"
call "Current#User.bat"
del "Current?User.bat" > nul
del reg.txt > nul

net use H: \\FileSrvr\users\%CurrentUser%\personal /YES

The printers I don't know about adding in a login script, but the script above will make it so that everyone is mapped to their own folders.

Hope this helps.
 
Many thanx Mpnut,

that is brilliant for the personal home directory mapping, any ideas on the 'my doc' replication issue ???

regards
 
The only thing I can think of is to add something in the script to copy all files from the current users My Documents folder to a My Documents folder on the server. This will overwrite the files on the server each time they copy. I don't know of a way to do anything such as only overwrite if the file is newer. You will also need to make sure that there is already a My Documents folder in the users personal folder. That can also be done in the script. Add this to the script from above.

IF EXIST "H:\FileSrvr\users\%CurrentUser%\My Documents" GOTO :COPY

MD "H:\FileSrvr\users\%CurrentUser%\My Documents"

:COPY

COPY /Y "C:\Documents and Settings\%CurrentUser%\My Documents\*.*" H:\FileSrvr\users\%CurrentUser%\My Documents"

I haven't tested this, but I think it should work. Let me know how it goes.
 
I guess I just do not understand why native features are not being used here.

You can define a HOME directory for users. The NET USE command has a HOME directory parameter. There are default environmental variables available here that are not being used, including USERNAME. There is an offline file syncronization feature. The default location of the 'My Docouments' is controllable through the profile for each user.

There have been numerous discussions of printer mapping in the logon script in this Forum, a keyword search would reveal a ton of material.

I am confused about the direction being taken here away from the core native features of the Server and Workstation OS.

 
Well, to be honest, I didn't know about these features your talking about. We have a network of 95/98/NT/2000/xp and more. This was an easy way to get backups from people's PC's because I am tired of having to restore from backups tapes, or just having to tell them, "Sorry. You deleted it. It's gone". I like to think that I've got a lot of knowledge, but when you don't you make do with what you know. There are ALWAYS more than one way to make things happen. If I choose to take the scenic route, then that's what I do. How about instead of saying "I just don't understand why your not doing it this way" you say, "Here's a feature. Give it a try."
 
Without offense I did offer several things to explore. In particular use the ability to specify a HOME directory in the user profile; utilize the /HOME switch on NET USE; use the offline file feature to synchronize local and network filestores; use default enviornmental variables in scripts and batch files.

There are many printer tricks, a simple one:

start \\printer_server\printer_name

If there is no printer already defined, you will be prompted to install the needed printer driver; and the connection will be made. Otherwise the printer is simply made available in the list of network printers for the user.

I had a similar reaction to yours when going from all Netware to all Windows. My epiphany was to learn to use the native features of the OS rather than try to imitate features of an earlier or different OS version, or to adapt workarounds one was forced to do in earlier versions.

In your mixed OS setting of Win9x and up, it becomes even more critical to use the server-side features of the OS, especially the profile features. It seems to me unwise to rely on parsing text files from direct registry calls to discover the variable %USERNAME%.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top