3.2 Using Identifier Variables

Many login script commands allow you to take advantage of identifier variables to make login scripts more efficient and flexible.

Use identifier variables 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 same login script command applicable to multiple users.

When using variables within login script commands, observe the following conventions:

For example, using the %LAST_NAME variable substitutes the user's actual last name for the LAST_NAME variable in the command when the user logs in. For example:

WRITE "Hello, ";LAST_NAME

or

WRITE "Hello, %LAST_NAME"

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

Hello, SMITH

The percent sign (%) is used only within literal text strings (that is, within quotation marks (“ “)). The semicolon (;) is used to concatenate the literal text string and the identifier variable.

Using the %GREETING_TIME variable displays the time of day. If Bob Smith logs in during the morning, both of the following lines display the same message (Good morning, SMITH) on his screen:

WRITE “Good “; GREETING_TIME;”, “; LAST_NAME
WRITE “Good %GREETING_TIME,%LAST_NAME”

The following table lists the identifier variables that work for both Linux and Windows workstations.

Table 3-2 Identifier Variables for Linux and Windows

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 (99, 00, 01)

 

YEAR

All four digits of year (1999, 2000, 2001)

DOS Environment

variable

Any DOS environment variable can be used in angle brackets. To use a DOS environment variable in MAP, COMSPEC, INCLUDE, DISPLAY, and FIRE PHASERS commands, add a percent sign (%) in front of the variable.

Miscellaneous

ACCESS_SERVER

Shows whether the access server is functional (TRUE = functional; FALSE = nonfunctional)

 

ERROR_LEVEL

An error number (0 = no errors)

 

%n

Replaced by parameters the user enters at the command line with the login utility

See Login Parameters with %n Variables.

NetWare Mobile

DIALUP

0 = Not using DIALUP

1 = Using NetWare Mobile Client DIALUP profile

 

OFFLINE

0 = Not offline

1 = Disconnected login

Network

FILE_SERVER

NetWare server name

 

NETWORK_ADDRESS

Internal number assigned by the network specifying where a device can be located in the network cabling system

Object Properties

property_name

You can use property values of eDirectory 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 END

Time

AM_PM

a.m. or p.m.

 

GREETING_TIME

Time of day (morning, afternoon, evening)

 

HOUR

Hour (12-hour scale; 1 through 12)

 

HOUR24

Hour (24-hour scale; 00 through 23)

 

MINUTE

Minute (00 through 59)

 

SECOND

Second (00 through 59)

User

CN

User's full login name as it exists in eDirectory

 

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 eDirectory and bindery-based NetWare. Spaces are replaced with underscores ( _ ).

 

LAST_NAME

User's surname in eDirectory or full login name in bindery-based NetWare

 

LOGIN_CONTEXT

User's context

 

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

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

 

OS_VERSION

Operating system version on the workstation

 

P_STATION

Workstation's node number (12-digit hexadecimal)

 

PLATFORM

Workstation's operating system platform

 

SHELL_TYPE

Version of the workstation's DOS shell; supports NetWare 2 and NetWare 3 shells and NetWare 4 Requester for DOS.

 

SHELL_VERSION

The version of the Novell Client, as displayed in the property pages. Provides a more effective testing of the Novell Client version from the login script.

 

SMACHINE

Short machine name (IBM, etc.)

Workstation (cont'd)

STATION

Workstation's connection number

 

WINVER

Version of the workstation's Windows operating system

3.2.1 Login Parameters with %n Variables

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

NOTE:Only four variables (%2 through %5) can be changed in the login screen.

When a user logs in, additional parameters can be entered that the LOGIN utility passes to the login script. The utility then substitutes these parameters for any %n variables in the login script. These variables are replaced in order by the parameters the user entered when logging in.

The %0 variable is replaced by the name of the NetWare server entered in the Login dialog box, and %1 is replaced by the user's fully distinguished login name. The remaining variables change, depending on what the user types when executing the LOGIN utility. The %n variables must precede all command line options.

The SHIFT command allows you to change the order in which these %n variables are substituted.