• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

Windows NT Login Scripts with Windows95 Client

I have 95 machines running the login script "Login.Bat" from the NT server and need to determine the users "USERNAME" and "HOMEPATH" on that 95 client.  Decisions in the script will be based on this variable.  Any ideas?
0
mamorian
Asked:
mamorian
1 Solution
 
clafleurCommented:
You can do hide shared folder with $ for your user on the server (homepath) In User manager for domain, select user, profile and go to the home directory topic.  connect (drive) \\servername\username$

also write logon.bat in logon script name.  The logon.bat need to be in %systemroot%\system32\repl\import\scripts (netlogon share)

In logon.bat you need to write

net use [home dir. drive] /home
net use [drive] \\servername\share /y





You can use some built-in variable :
%COMPUTERNAME% Name of computer
%HOMEDRIVE% Users local drive letter
%HOMEPATH% The full path of the users home area
%HOMESHARE% The share that contains the users home area
%LOGONSERVER% This is the name of the machine that validates the user logon
%OS% The operating the User is connected to
%PROCESSOR% e.g. 486 (useful to put in a login script and ridicule if a 386 or below)
%USERDOMAIN% Domain containing the Users Account
%USERNAME% The name of the user


good luck

0
 
mbreukerCommented:
The most basic answer that immediately comes to mind is to create a template login script, say login.bat, and each time you add a new user, make the appropriate change to login.bat and save it as username.bat. When creating the new user in User Manager, specify the login script to be username.bat rather than login.bat.

I get the feeling that for one reason or another, it is not that easy for you. I understand. I recently had to implement a login script on a network where everyone uses the same username and I needed to base script decisions on the machine name, which doesn't exist as a variable in Windows 95. My solution, thanks to the help of people here at Expert's Exchange, was to create the variable. Here is one way it can be done. . .

1. Make use of the command "NET CONFIG," which generates the following output:

Computer name                    \\COMPUTER_NAME
User name                           USERNAME
Workgroup                           WORKGROUP
Workstation root directory     C:\WINDOWS

Software version               4.00.950
Redirector version             4.00  
The command was completed successfully.

In the first part of your login script, add the following line

   net config > c:\config.txt

This will create a text file on the local machine which contains the relevant information you need. Next you make use of the "find" command, which will let you extract that information. The problem with the "find" command is that you must search for specific text, so you must use errorlevel checking and search for each possible username. This creates some work when first writing the batch file, but is easy maintenance afterward. Here is an example of using "find" to discover the username, set the environment variable to match, and then acting on that information.

:StartFind

:User1
find /i "User1" c:\config.txt > nul
if errorlevel 1 goto User2
set USERNAME=User1
set HOMEPATH=u:\user1
goto EndFind

:User2
find /i "User2" c:\config.txt > nul
if errorlevel 1 goto User3
set USERNAME=User2
set HOMEPATH=u:\User2
goto EndFind

:User3

 . .

:EndFind

:StartScript
Echo "Hello, you are logged in as" %USERNAME%

If %USERNAME% == User1 Goto Message
Goto EndMessage

:Message
echo "Warning: You're account will expire at the end of them month, please call the HelpDesk."
pause
:EndMessage

:StartBackup
copy c:\data\user.dat %HOMEPATH%
:End Backup

:End



As you can see, I have a lot of freedom within the script once I have the environment variable set to what I need. While the initial steps here are sophisticated and tedious (although not hard really), it can be quite easy to manage after that. Each time you add a new user, just add a new line the script. The execution of the net config command and the subsequest searching for data takes only a fraction of a second and is hardly noticeable.

Let me know if you need further information or if you would like to use this an an answer.

- Mike
0
 
mbreukerCommented:
I see that someone else submitted an answer while I was typing this "Thesis."
I will only point out that Windows 95 does not contain the environment variables that are listed (only NT does this which is why login scripts for NT are a hell of a lot easier) and thus the need to use the NET CONFIG + FIND routines I have described.

Good Luck.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
mamorianAuthor Commented:
The hidden share portion of your answer does not pertain to my question.

The built in variables you mention do not apply to Windows95.


0
 
mbreukerCommented:
Have you had a chance to look at my comment?
0
 
TSauerCommented:
Try using Kixtart, in the newer versions there is a support for this variables not supported by standard.
0
 
mamorianAuthor Commented:
Using mbreuker's response, I was able to do exactly what I needed to do.  Could not have been a better answer.

I will however look at Kixtart simply to get familiar with it.

Thanks all.
0
 
mbreukerCommented:
I thought I answered this already, but maybe it did not register. Anyway, glaad I could help.
0
 
mamorianAuthor Commented:
could not have been more on.  I am using these tricks in production right now.....
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now