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 LAST_NAME), rather than a specific name (such as Smith) in a login script command. When the login script executes, it substitutes real values for the identifier variables.

By using the variable, you can make the login script command applicable to many users instead of limiting it to one user.

For example, the command

WRITE Hello, %LAST_NAME

displays the following message on Bob's Smith's workstation screen when he logs in:

Hello, SMITH

Similarly, when Mary Jones logs in, the message she sees is

Hello, JONES

In the previous example, when the user logged in, the user's actual last name was substituted for the LAST_NAME variable in the command.

Table 19 lists all the available identifier variables.


Table 19. Login Script 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; 1=Sunday)

 

SHORT_YEAR

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

 

YEAR

All four digits of year (1994, 1995, 1996, 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)

User

%CN

User's full login name as it exists in NDS

 

LOGIN_ALIAS_CONTEXT

Y IF REQUESTER_CONTEXT is an Alias

 

FULL_NAME

User's unique username. It is the value of the FULL_NAME property for both NDS and bindery-based NetWare. Spaces are replaced with underscores

 

LAST_NAME

User's last name (surname) in Novell Directory Services, or full login name in bindery-based NetWare

 

LOGIN_CONTEXT

Context where user exists

 

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 is not assigned to

 

PASSWORD_EXPIRES

Number of days before password expires

 

REQUESTER_CONTEXT

Context when login started

 

USER_ID

Number assigned to each user

Network

FILE_SERVER

NETWORK_ADDRESS

NetWare server name

IPX external network number of the cabling system (8-digit hexadecimal number)

Workstation

MACHINE

Type of computer (IBM_PC, etc.)

 

NETWARE_REQUESTER

Version of the NetWare Requester for OS/2 or VLM users

 

OS

Type of operating system on the workstation (MSDOS, OS2, etc.)

 

OS_VERSION

Operating system version on the workstation (3.30, etc.)

 

P_STATION

Workstation's node number (12-digit hexadecimal)

 

PLATFORM

Workstation's operating system platform: DOS, OS2, WIN (Windows 3.1), WNT (Windows NT*), or W95 (Windows 95*)

 

SHELL_TYPE

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

 

SMACHINE

Short machine name (IBM, etc.)

 

STATION

Workstation's connection number

DOS environment

<variable>

Any DOS environment variable can be used in angle brackets (<path>, etc.). To use a DOS environment variable in MAP, COMSPEC, and FIRE PHASERS commands add a percent sign (%) in front of the variable. For example,

MAP S16:=%<path>

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. For more information, see Table 19.

Object properties

property name

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

To use a property name with a space, within a WRITE statement, you must place it at the end of the quoted string:

WRITE Given name=%GIVEN_NAME

IF %MESSAGE SERVER=MS1 THEN

MAP INS S16:=MS1\SYS:EMAIL

To see a list of object properties, see Appendix A, NDS Object Classes and Properties, of Guide to NetWare4 Networks. Not all properties are supported.


Using Identifier Variables

When using identifier variables in login script commands, observe the following conventions.


Examples


Using LOGIN Parameters with %n Variables

Some variables in a login script can be indicated by a percent sign (%) followed by a number from 0 to 9.

When a user logs in, he or she can type additional parameters that the LOGIN utility passes to the login script. The login script then substitutes these parameters for any %n variables in the login script. These variables are replaced in order by the parameters the user typed when executing the LOGIN utility.

The %0 variable is replaced by the name of the NetWare server the user typed at the command line, and %1 is replaced by the user's login name. The remaining variables change, depending on what the user types when executing LOGIN. The %n variables must precede all command line options.

The SHIFT login script command allows you to change the order in which these %n variables are substituted. For more information about the SHIFT command, see SHIFT

The %n variables can be used in WRITE statements if included within the quotes:

WRITE My login name is %1.


Example

Suppose a login script contains the following commands:

IF %2=SALES THEN

WRITE Meeting today

END

IF %3=LEGAL THEN

WRITE Report is due tomorrow

END

If user RON logged in by typing the following command:

LOGIN COUNT\RON SALES MARKETING

then the login script would substitute the values Ron entered at the keyboard for the %n variables in the login script, as shown here:

%0=COUNT

%1=RON
%2=SALES
%3=MARKETING

Since %2 is replaced by SALES, the message Meeting today is displayed on Ron's screen. However, since %3 is replaced by Marketing, Ron doesn't see Report is due tomorrow.