Login scripts

Files containing commands that set up users' workstation environments whenever they log in. Login scripts are similar to batch files and are executed by the LOGIN utility.

You can use login scripts to

Login scripts work the same way for DOS, MS Windows, and OS/2 workstations, although some commands that apply to DOS and MS Windows workstations may not apply to OS/2 workstations.


Three Types of Login Scripts

When a user logs in, the LOGIN utility executes the appropriate login scripts. Three types of login scripts can be used together to specify a custom environment for your users. All three types of login scripts are optional.

The LOGIN utility contains a default login script. This login script executes the first time you log in as User object ADMIN. It contains only essential commands, such as a drive mapping to NetWare utilities.

This default login script also executes for any user who doesn't have an individual user login script.

If you don't want to create a user login script and you want to prevent the default login script from executing, you can disable the default script by including the NO_DEFAULT command in the container or profile login scripts.


Which Types of Login Scripts to Create

Maintaining many user login scripts can be time consuming. Therefore, include as much customizing information as possible in the container and profile login scripts, which are fewer in number and easier to maintain.

For example, if all users need access to NetWare utilities in the same volume, put the search drive mapping to that volume in a single container login script rather than in every user login script.

Create profile login scripts if there are multiple users with identical login script needs. These are sometimes thought of as group login scripts.

Finally, in user login scripts, include only those individual items that can't be included in profile or container login scripts.

Since up to three login scripts can execute whenever a user logs in, conflicts can occur. If this happens, the last login script to execute (usually the user login script) overrides any conflicting commands in a previous login script.

Login scripts are properties of objects.

The following table shows which objects can contain login scripts

Object Type of login script

Organization

Container

Organizational Unit

Container

Profile

Profile

User

User

The following figure shows how the different types of login scripts can reside in a Directory tree and how they affect users.

Figure 43
Where Login Scripts Are Located

In the previous figure, there are three users, ESAYERS, SWILLIAMS, and MRICHARD. The following table shows which login scripts execute when each user logs in.

When this users logs in Login scripts execute in this order

ESAYERS

1. SALES PV's container login script

2. ESAYERS's user login script

SWILLIAMS

1. SALES PV's container login script

2. Default user login script

MRICHARD

1. ACCOUNTING's container login script

2. CLERKS' profile login scriptMRICHARD's user login script

Container login scripts only affect users immediately below the Organization or Organizational Unit that contains the login script.

For example, in the figure, although there are two levels of container objects above users ESAYERS and SWILLIAMS, only the container login script immediately above them (at OU=SALES PV) executes when they log in.

If SALES PV had no container login script defined, no container login script would execute for ESAYERS and SWILLIAMS, even though a container login script exists at a higher level.

Since SWILLIAMS has no user login script defined, the default login script executes after the container login script.

Since MRICHARD belongs to the profile CLERKS, the CLERKS' profile login script executes before MRICHARD's user login script. Users can belong to only one Profile, so only one profile login script can execute for any user.


Creating, Modifying, and Copying Login Scripts

You can use either the NETADMIN utility or the NetWare Administrator utility to create or modify login scripts.

The main difference in creating container, profile, and user login scripts is the object you select to contain the scripts.

All three scripts use the same conventions, commands, and variables.


Login Script Commands

Some of the commands you can use in login scripts are listed in the following table. (For a list of all login script commands and a complete description of each, see Login Script Commands and Variables in Chapter 3 of Supervising the Network.)


Table 6. Selected Login Script Commands

Login script command Description

ATTACH

Connects to bindery-based NetWare servers (NetWare 2 or NetWare 3) or to NetWare 4 servers using bindery services.

COMSPEC

If users run DOS from the network, this specifies the directory where the DOS command processor (COMMAND.COM) is loaded.

Users running OS/2 shouldn't use this command in the login script.

EXIT

Terminates execution of the LOGIN utility and executes an external program (doesn't apply to OS/2 workstations).

FIRE PHASERS

Emits a phaser sound when certain conditions exist.

IF...THEN

Performs an action only under certain conditions.

MAP

Maps drives and search drives to network directories and NDS objects.

PAUSE

Creates a pause in the execution of the login script.

SET

Sets a DOS or OS/2 environment variable.

For OS/2 workstations, SET commands affect the environment only while the login script is running; the settings disappear when LOGIN terminates.

WRITE

Displays messages on the workstation screen when a user logs in.


Identifier Variables

With many login script commands, you can take advantage of identifier variables to make your login script more efficient and flexible.

Identifier variables allow you to enter a variable (such as LOGIN_NAME) in a login script command, rather than a specific name (such as RICHARD). By using the variable, you can make the login script command applicable to many users.

When the login script executes, it substitutes real values for the identifier variables. Therefore, when Richard logs in, the command

WRITE Hello,;LOGIN_NAME

displays the following message on Richard's workstation screen:

Hello, Richard

In the above example, when Richard logged in, the name he entered was substituted for the LOGIN_NAME variable.

The following table lists identifier variables you can use in login scripts.


Table 7. Identifier Variables

Category Identifier variable Function

Date

DAY

Day number (01 through 31).

 

DAY_OF_WEEK

Day of week (Monday, Tuesday, etc.).

 

MONTH

Month number (01 through 12).

 

MONTH_NAME

Month name (January, February, etc.).

 

NDAY_OF_WEEK

Weekday number (1 through 7, with 1=Sunday).

 

SHORT_YEAR

Last two digits of year (93, 94, 95, etc.).

 

YEAR

All four digits of year (1993, 1994, 1995, etc.).

Time

AM_PM

Day or night (am or pm).

 

GREETING_TIME

Time of day (morning, afternoon, or evening).

 

HOUR

Hour (12-hour scale; 1 through 12).

 

HOUR24

Hour (24-hour scale; 00 through 23, 00=midnight).

 

MINUTE

Minute (00 through 59).

 

SECOND

Second (00 through 59).

DOS Environment

<variable>

Any DOS environment variable can be used in angle brackets (<path>, etc.). To use a DOS environment variable in a MAP command, add a percent sign (%) in front of the variable, such as MAP S16:=%<path>.

Network

FILE_SERVER

NetWare server name.

 

NETWORK_ADDRESS

Network number of the cabling system (8-digit hexadecimal number).

User

FULL_NAME

User's complete name in the Directory context, or full name in bindery-based NetWare.

 

LAST_NAME

User's last name (surname) in NDS, or full name in bindery-based NetWare.

 

LOGIN_NAME

User's unique login name. (Long names are truncated to eight characters.)

 

MEMBER OF group

Group object that the user is assigned to.

 

NOT MEMBER OF group

Group object that the user isn't assigned to.

 

PASSWORD_EXPIRES

Number of days before password expires.

 

PLATFORM

Workstation's operating system platform: DOS, OS2, WIN (Windows3.1), WNT (WindowsNT*), or W95 (Windows95*)

 

USER_ID

Number assigned to each user.

Workstation

MACHINE

Type of computer (IBM_PC, etc.). See your DOS manual for more information. (Not available under OS/2.)

 

NETWARE_REQUESTER

Version of the NetWare Requester for OS/2 (2.01, etc.).

 

OS

Type of DOS on the workstation (DRDOS, MSDOS, etc.).

 

OS_VERSION

Version of DOS on the workstation (3.30, etc.).

 

P_STATION

Workstation's node address (12-digit hex).

 

SHELL_TYPE

Version of the workstation's DOS shell (1.02, etc.). Supports NetWare 2 and NetWare 3 shells and NetWare 4 Requester for DOS.

 

SMACHINE

Short machine name (IBM, etc.). (Not available under OS/2.)

 

STATION

Workstation's connection number.

Miscellaneous

ACCESS_SERVER

Shows whether the access server is functional (TRUE=functional, FALSE=not functional).

 

ERROR_LEVEL

An error number (0=No errors).

 

%n

Replaced by parameters the user enters at the command line with the LOGIN utility.

Object properties

property name

You can use any property of NDS objects as a variable. Use the property's name just as you do any other identifier variable. If the property name includes a space, enclose the name in quotation marks.


Sample Login Scripts

The following sample login scripts may help you plan your own container, profile, and user login scripts. Each example script is shown in a table. The left column shows the commands in the script. The right column explains the command.

Container login script. The container login script should contain any information that applies to all users.


Table 8. Sample Container Login Script

Login script commands Purpose

MAP DISPLAY OFF

Prevents map commands from displaying on the screen.

MAP ERRORS OFF

Prevents mapping errors from displaying on the screen.

MAP *1:=SYS:

Maps the first drive to volume SYS:.

MAP *1:=SYS:%LOGIN_NAME

Maps the first drive to the user's home directory. If the user has no home directory, the first drive is still mapped to SYS:.

IF %1= ADMINTHEN MAP *1:=SYS:SYSTEM

If the login name is ADMIN, it maps the first drive to SYS:SYSTEM instead of to the user's home directory.

IF OS2 THEN

MAP P:=SYS:PUBLIC

ELSE

MAP INS S1:=SYS:PUBLIC

MAP INS S2:=SYS:PUBLIC\%MACHINE\%OS\ %OS_VERSION

END

If the user logs in from an OS/2 station, drive P: maps to PUBLIC. (See NetWare 2 and 3 Users Upgrading to NetWare 4, in IntranetWare Client for OS/2 User Guide.)

If the user isn't using an OS/2 station, the first search drive is mapped to SYS:PUBLIC, where DOS-based NetWare utilities are stored. The second search drive is mapped to the directory where DOS is stored.

For example, if all stations use DOS, use the following two commands instead of the IF...THEN command:

MAP INS S1:=SYS:PUBLIC
MAP INS S2:=SYS:PUBLIC\ %MACHINE\%OS\%OS_VERSION

IF MEMBER OF WIN31 THEN

MAP INS *2:=SYS:USERS\%LOGIN_NAME\WIN31

MAP INS S16:=SYS:APPS\WINAPPS\WIN31

SET TEMP = P:\USERS\%LOGIN_NAME\WIN31\TEMP

END

If the user who logs in is a member of Group object WIN31, the next available drive is mapped to that user's MS Windows directory. Then the next available search drive is mapped to the MS Windows directory for the WIN31 group. Finally, the MS Windows TEMP directory is set to a subdirectory of the user's MS Windows directory.

MAP INS S16:=VOL1:APPL\WP

Maps the next available search drive to the directory that contains WordPerfect*.

MAP INS S16:=VOL1:APPL\LOTUS

Maps the next available search drive to the directory that contains Lotus*.

MAP INS S16:=SYS:EMAIL

Maps the next available search drive to the E-mail directory.

MAP O:=SYS:DOC

Maps drive O: to a directory necessary for running the electronic NetWare documentation.

IF MEMBER OF MANAGERS THEN

MAP *3:=VOL1:PROJECTS\REPORTS

END

If the user belongs to the MANAGERS Group object, the script maps the third network drive to the REPORTS directory.

IF MEMBER OF TESTERS THEN

MAP *4:=INPUT:STATUS\UPDATES

END

If the user belongs to the TESTERS Group object, the script maps the fourth network drive to the UPDATES directory.

COMSPEC = S2:COMMAND.COM

Sets COMSPEC to the DOS command processor, located in the DOS directory (in the second search drive).

SET PROMPT = $P$G

Sets the prompt to display the user's current directory path, followed by the > symbol.

MAP DISPLAY ON

Allows map commands to display.

MAP

Displays a list of all drive mappings.

WRITE

Displays a blank line between the list of mappings and following lines.

WRITE Good %GREETING_TIME, %FULL_NAME.

Displays a greeting to the user. Example: Good morning, MARY.SALES.NOVELL.

WRITE Your password expires in

%PASSWORD_EXPIRES days.

Displays a message indicating the number of days before the user's password expires.

FIRE PHASERS 3 TIMES

Makes the phaser sound occur three times, to tell the user that the login process is complete.

Profile login script. If you have groups of users with identical login script needs, you can create a Profile object and create a login script for the Profile object. Then, you can assign each user a member of that Profile object.

The following is an example of a profile login script you might create for users in the ACCOUNTING Profile object. The ACCOUNTING profile login script would execute after the container login script.


Table 9. Sample Profile Login Script

Login script commands Purpose

MAP DISPLAY OFF

Prevents map commands from displaying on the screen as they are assigned.

MAP ERRORS OFF

Prevents mapping errors from displaying on the screen.

MAP INS S16:=VOL1:APPL\DB

Maps the first available search drive (after those assigned in the container login script) to the directory that contains the database program.

MAP *5:=VOL1:ACCOUNTS\NEW

Maps the fifth network drive (after those assigned in the container login script) to the NEW subdirectory.

MAP *6:=VOL1:ACCOUNTS\RECORDS

Maps the sixth network drive (after those assigned in the container login script) to the RECORDS subdirectory.

#WSUPDATE S1:IPXODI.COM /LOCAL

Executes WSUPDATE, which updates the IPXODI.COM file on the user's workstation with a new version of the file located in the first search drive.

MAP DISPLAY ON

Allows map commands to display.

MAP

Displays a list of all drive mappings.

WRITE

Displays a blank line between the list of mappings and following lines.

IF DAY_OF_WEEK = FRIDAY THEN

WRITE Weekly progress report is due today.

FIRE 2

END

On Fridays, the phaser sound occurs twice to alert the user while the message Weekly progress report is due today displays on the screen.

PCCOMPATIBLE

EXIT NMENU WORK

Stops the profile login script and sends the user into a menu program called WORK.

EXIT also prevents user login scripts from executing. If you want a user login script to execute after the profile script, put these lines at the end of the user login script instead.

DOS workstations with the machine name IBM_PC don't need the PCCOMPATIBLE line.

EXIT doesn't work on OS/2 workstations.

User login script. The following is an example of a user login script for MARY. The user login script executes after container and profile login scripts.


Table 10. Sample User Login Script

Login script commands Purpose

MAP DISPLAY OFF

Prevents map commands from displaying on the screen as they are assigned.

MAP ERRORS OFF

Prevents mapping errors from displaying on the screen.

MAP *7:=VOL1:MARY\PROJECTS\RESEARCH

Maps Mary's seventh network drive (after those assigned in the container and profile scripts) to the RESEARCH subdirectory in her home directory.

MAP *8:=VOL1:FORMS

Maps Mary's eighth network drive (after those assigned in the container and profile scripts) to the FORMS directory.

REM Mary needs access to FORMS while she's on the

REM troubleshooting team. Remove this drive mapping

REM when she's reassigned.

This remark is a reminder to the person who created the login script. It doesn't display on the user's screen.

(Because the remark is several lines long, each line starts with the keyword REM.)

SET WP=/u-mjr/b-5

Sets Mary's environment variables for WordPerfect.

SET USR=mrichard

Sets Mary's user name (mrichard) for the electronic mail program.

#CAPTURE Q=FAST_Q NB TI=10 NFF

Executes the CAPTURE utility so Mary can print from non-network applications.

PCCOMPATIBLE

EXIT NMENU TRAINING

Stops the user login script and sends the user into a menu program called TRAINING.

DOS workstations with the machine name IBM_PC don't need the PCCOMPATIBLE line.

The EXIT command doesn't work on OS/2 workstations.

NOTE:  If you did not exist as a user on a server before it was upgraded to NetWare 4 and you now need to log in via bindery services, use SYSCON (a NetWare 3 utility) to create the login script.

For information about creating, modifying, and copying login scripts, see Creating, Modifying, Copying, and Printing Login Scripts in Chapter 3 of Supervising the Network.

See also Drive mapping.