?
Solved

Windows NT Login Scripts with Windows95 Client

Posted on 1999-01-28
9
Medium Priority
?
368 Views
Last Modified: 2013-12-23
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
Comment
Question by:mamorian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 

Expert Comment

by:clafleur
ID: 1572302
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
 
LVL 2

Expert Comment

by:mbreuker
ID: 1572303
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
 
LVL 2

Expert Comment

by:mbreuker
ID: 1572304
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
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!

 

Author Comment

by:mamorian
ID: 1572305
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
 
LVL 2

Expert Comment

by:mbreuker
ID: 1572306
Have you had a chance to look at my comment?
0
 
LVL 3

Expert Comment

by:TSauer
ID: 1572307
Try using Kixtart, in the newer versions there is a support for this variables not supported by standard.
0
 

Author Comment

by:mamorian
ID: 1572308
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
 
LVL 2

Accepted Solution

by:
mbreuker earned 800 total points
ID: 1572309
I thought I answered this already, but maybe it did not register. Anyway, glaad I could help.
0
 

Author Comment

by:mamorian
ID: 1572310
could not have been more on.  I am using these tricks in production right now.....
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Greetings, Experts! First let me state that this website is top notch. I thoroughly enjoy the community that is shared here; those seeking help and those willing to sacrifice their time to help. It is fantastic. I am writing this article at th…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

770 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