 |
» |
|
|
 |
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 5-6 lists all the available identifier variables. Table 5-6 Login
Script Identifier Variables Category | Identifier
Variable | Function |
|---|
Date | DAY DAY_OF_WEEK MONTH MONTH_NAME NDAY_OF_WEEK SHORT_YEAR YEAR | Day
number (01 through 31) Day of week (Monday, Tuesday,
etc.) Month number (01 through 12) Month
name (January, February, etc.) Weekday number (1 through
7; 1=Sunday) Last two digits of year (94, 95, 96, etc.) All
four digits of year (1994, 1995, 1996, etc.) | Time | AM_PM GREETING_TIME HOUR HOUR24 MINUTE SECOND | Day
or night (am or pm) Time of day (morning, afternoon,
or evening) Hour (12-hour scale; 1 through 12) Hour
(24-hour scale; 00 through 23; 00=midnight) Minute (00
through 59) Second (00 through 59) | User | %CN | User's
full login name as it exists in NDS™. | | 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 NDS 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 to which the user is assigned. | | NOT
MEMBER OF "group" | Group
object to which the user is not assigned. | | 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 VLM users. | | OS | Type
of DOS on the workstation (MSDOS, etc.). | | OS_VERSION | Operating-system
version on the workstation (3.30, etc.). | | P_STATION | Workstation's
node address (12-digit hexadecimal). | | 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 ERROR_LEVEL %n | Shows
whether the access server is functional (TRUE=functional, FALSE=not
functional). An error number (0=no errors). Replaced by parameters
the user enters at the command line with the LOGIN utility. For
more information, see "Using LOGIN Parameters with %n Variables"
in this chapter. | 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 and Bindery Objects
and Properties," of Utilities Reference.
Not all properties are supported. |
Using Identifier Variables |  |
When using identifier variables in login script commands,
observe the following conventions: ...Identifier
variables are used most often with commands such as IF...THEN,
MAP, and WRITE. They can also be used with commands for which you
can specify a path, such as COMSPEC. Type the variable exactly as shown. To use DOS environment variables as identifiers,
enclose them in angle brackets. Identifier variables can be placed within literal
text strings in a WRITE statement. However, the identifier variable
must be in uppercase letters and preceded by a percent sign. (Literal
text is the text that is displayed on the screen, such as "Sales
report is due today." Literal text must be enclosed in
quotation marks.)
If user Smith logs in during the morning,
both of the following lines display the same message on his screen
("Good morning, SMITH"): WRITE "Good "; GREETING_TIME; ", "; LAST_NAME |
WRITE "Good %GREETING_TIME, %LAST_NAME" |
To use DOS environment variables as identifiers,
enclose them in angle brackets. The following example uses the DOS
environment variable "path": WRITE "my path is "%<path> |
The text displayed on the screen is similar to this: my path is z:.;y:.;c:\WINDOWS |
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" in this chapter. The %n variables can be used in WRITE statements if they are
included within the quotation marks: WRITE "My login name is %1." |
Suppose a login script contains the following commands: WRITE "Report is due tomorrow" |
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."
|