Discussion Locked

Getting username for variable

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am relatively new to Netware so this may be a generic question for some of you. I am trying to write a script that will be user specific. We are running WinNT4 on our worksations. The script will find out what Netware user is logged in, go to their home directory, then copy everything there to the local hard drive. I need to set the user variable because we have several people using the same machine. This would allow me to keep the data seperate. Is there a way of pulling that data from a command line so I can write a batch file to accomplish this?

5 replies

by jimbb

Sounds like you try to copy/restore something like roaming profiles. Have you considered ZENworks to do this for you?
Anyway, the login script can help you, either by executing an external command (like "#xcopy h:\*.* c:\somewhere"), then you don't need any variables. Or, since you set the user's home-directory anyway, why not copy from that drive-name from within your script, in stead of looking it up via-via?
Anyway, if you need to have some sort of a variable, you can use the login script to put a value in a DOS environment variable, to be re-used however you like. Try "set username=%LOGIN_NAME", for example.

Jim

by estebandelatorre

Easy!
Example
NDS User = ESTEBAN

At the login script of the container where the user resides add the following
SET USER=%LOGIN_NAME
This will place a SET USER=ESTEBAN at the DOS environment table of the client (Open a D.O.S) and type SET to see it)
Usually the NW home directory of ESTEBAN, resides in \\server\volume\home\esteban.
You can refered to this path using the USER environment variable like this:
\\server\volume\home\%USER%
and make a .bat file like this

REM clear the destination c: directory
deltree c:\myfiles\*.* /y
REM copy server files to c:\myfiles
copy \\server\volume\home\%user%\myfiles\*.* c:\myfiles
You can call this batch file from the user login script, the workstation or the container login script as it's last instruction

exit "mybacht.bat"

Allways watch CASE, BLANK SPACES, and " "

edt@bancobgn.com

This discussion is closed to new replies.