This section describes commands provided by ICMD.NLM, a companion to the NetWare Installation NLMs (INSTALL.NLM and NWCONFIG.NLM). See NetWare Installation Command Version Availability for a table showing the ICMD versions that support these commands.
If you intend to use ICMD.NLM 2.18 or greater, do not copy this new version to SYS:SYSTEM. Instead, copy it to a different directory and load it from there.
For example, the script commands below will copy ICMD.NLM to a temporary directory and load from there.
CopyToServer SYSTEM\TMP, ICMD.NLM, "", ""
Command TMP\ICMD
Using this method ensures that the ICMD.NLM version in SYS:SYSTEM is the actual 4.10 version and that all built-in products that use it will work properly. The new ICMD.NLM might still be fully backward-compatible, but it has not yet been fully tested in that regard.
To use any of the external commands made available by the ICMD.NLM command handler, include the statement command [<filepath>] ICMD in the script file. Use CopyToServer to copy ICMD.NLM to a temporary directory (for example, SYS:SYSTEM\TEMP), then use command to run it from there (for example, command SYS:SYSTEM\TEMP\ICMD). This removes any compatibility problems associated with using the standard ICMD.NLM in SYS:SYSTEM. You can create then add additional commands to your own version of ICMD.NLM (after you rename the file) to perform application-specific functions.
Activate
Activate causes the installation screen to be activated.
Activate
The installation screen will be displayed for further script processing.
AppendFile <src var name>, <src file spec>, <src vol name>, <src descr>, <dest var name>, <dest dir>, <dest vol name>, <dest descr>
AppendFile appends the contents of the source file onto the destination file. It creates a temporary file that is as large as the destination file, then renames that file to the destination file. Wildcard characters for <src file spec> are not allowed.
AppendFile input, file1, 'NETWARE-1', "NW [1]", output, file2, '', ''
The user is prompted for diskette NW [1], which is verified by checking for volume label NETWARE-1. The FILE1 on that diskette is appended to FILE2 in the directory corresponding to output.
AppendTextToFile <src var name>, <src file spec>, <src vol name>, <src descr, <text>
AppendTextToFile appends the contents of the literal text onto the destination file. It also places a date timestamp with every entry. Wildcard characters for <src file spec> are not allowed.
If the file is found, the value of variable NWSTATUS will be zero; otherwise it will be non-zero.
AppendTextToFile input, file1, 'NETWARE-1', "NW[1]", 'Installation Complete'
The user is prompted for disk NW[1], which is verified by checking for volume label NETWARE-1. The FILE1 on that disk will be appended to FILE2 in the directory corresponding to the output.
CheckFile <var name>, <file spec>, <vol name>, <description>
CheckFile checks for the existence of <file spec> at a path determined by the value of <var name>. If the path is a floppy, and <vol name> is non-null (not ''), the user will be prompted for disk <description> if it is not already in the drive.
If the file is found, the value of variable NWSTATUS will be zero; otherwise it will be non-zero.
CheckFile NWSRC, file1.dat, '', ''
GotoIfNEqual '%{NWSTATUS}', 0, FileNotFound
File found
.
.
Label FileNotFound
In this example, a check is made for a file (FILE1.DAT). If the file is found at the path determined by NWSRC, execution continues on the next line. If the file is not found, control branches to label FileNotFound.
Config <flag>
Config creates a configuration file with available default information from the installation. If <flag> is 1, AUTOEXEC.NCF is created on SYS:SYSTEM; if 0, STARTUP.NCF is created in the server boot path.
Config 1
This command creates AUTOEXEC.NCF, with server name, internal net address, configured LAN driver load and bind commands, directory service and time services information. The existing AUTOEXEC.NCF on SYS:SYSTEM is overwritten.
Console <text>, <delay in seconds>
Console enters the text on the system console screen and delays <delay in seconds> before returning control back to the calling process. Because the system installation process executes in a different thread from the console, it is possible that the next command might finish before this Console command does. If the delay is set at -1, Console will delay until the system console screen has processed all the commands in its buffer.
Console 'load ne2000 frame=ethernet_802.3 int=3 port=300', 10
Console 'bind ipx to ne2000 net=1240000', 3
These commands load and bind an NE2000TM driver to IPXTM.
CopyFile <recurse flag>, <directory flag>, <empty flag>, <attribute flag>, <attributes>, <src var name>, <src file spec>, <src vol name>, <src descr>, <dest var name>, <dest dir>, <dest vol name>, <dest descr>, [<conditional copy flag>]
CopyFile copies files (wildcards are allowed in <src file spec>) from the source path to the destination path.
<recurse flag> (0|1)
Value | Description |
---|---|
0 |
Do not copy subdirectories recursively. |
1 |
Copy subdirectories recursively. |
<directory flag> (0|1|2|3)
<empty flag> (0|1)
Value | Description |
---|---|
0 |
No error if no files are found. |
1 |
Error if no files are found. |
<attribute flag> (0|1|2)
Value | Description |
---|---|
0 |
Use the default file set attributes. |
1 |
Use the source file's attributes. |
2 |
Use the attribute specified by <attributes> (must be used to copy to DOS drive). |
<attributes>
For a DOS file:
Attribute | Meaning |
---|---|
00000001 |
Read Only |
00000002 |
Hidden |
00000004 |
System |
00000008 |
Volume Label |
For a NetWare file:
Reserved path names (<src|dest var name>) are NWSRC, NWDST and NWBOOT, the standard source, destination and boot path for NetWare files. <dest dir name> can be a null string.
<conditional copy flag>
CopyFile 0, 0, 1, 0, 0, input, *.*, 'NETWARE-1', "NW [1]", output, '', '', ''
This is a continuation of the examples for GetPath. The user is prompted for diskette NW [1], and the diskette is verified by checking for volume label NETWARE-1. All files on the diskette are copied to the subdirectory the user indicated for output.
CopyFloppyImage <floppy type flag>, <diskette name>, <src var name>, <src file spec>, <src vol name>, <src descr>, <dest var name>, <dest dir>, <dest vol name>, <dest descr>
CopyFloppyImage copies a diskette image file sector by sector to the specified drive (destination path which must be a diskette drive).
Variable | Description |
---|---|
<floppy type flag> (0|1) |
0 indicates a 3.5-inch high-density drive. 1 indicates a 5.25-inch high-density drive. |
<diskette name> |
The external label for the diskette. |
GetPath, dst, 2, 'A:', ''
CopyFloppyImage 0, "Disk 1", 3.5\WSDOS_1.IMG, '', '', dst, '', '', ''
The floppy image specified by the source path is copied to the diskette in the specified drive.
Delay <delay in seconds>
Delay relinquishes control for <delay in seconds> seconds before returning control back to the calling process. If a negative value is used, the delay is a random value from 0 to the absolute value of <delay in seconds>.
Delay '-10'
This delays randomly from 0 to 10 seconds.
DiskReset <var name>
DiskReset tells DOS to rescan the directories on the <var name> floppy drive. This is necessary because the drive change interrupt is disabled while NetWare has control.
Assuming myDir corresponds with A:\
DiskReset myDir
Drive A:\will be rescanned.
DisMountCD <CD Volume Name>
DisMountCD is to be used with PromptForCD (below). It is used to dismount a CD volume that has been mounted via the PromptForCD command.
DisMountCD 'CDVolumeName'
Display_Text_File <Path>, <Filename>, <Completion Code>
Display_Text_File displays an ASCII text file. The user can scroll the text in any direction to read the entire contents of the file. Scroll bars automatically display if needed. The maximum file size is 30 KB for the file.
GetPath sys, 1, 'SYS:', ''
Display_Text_File sys, "license.txt", ccode
The completion code will return a 0 (zero) for a successful return. Anything else is an error.
Display <0|1|2>, "...<text>..."
Display displays a message, accompanied by a beep if the first argument is 1. If the argument is 2, the message is displayed as a copy status.
Display 0, "Product XYZ installation is complete."
The text is displayed (without a beep), and the user can press Enter to continue.
DSInst <time zone name>, <time server type>, <daylight flag>, <daylight start>, <daylight end>, <daylight offset in seconds>, <tree name>, <tree address>, <container object name>, <admin name>, <admin password>, <replica flag>, <upgrade bindery flag>, <root server flag>
DSInst installs the directory with default time synchronization.
DSInstMST7MDT, SECONDARY, 1, '(APRIL SUNDAY FIRST 2:00:00 AM)', '(OCTOBER SUNDAY LAST 2:00:00 AM)', 3600, URSA, FACE3234, 'O=Novell', 'CN=Admin.O=Novell', '', 1, 1, 0
Time services will be installed with this server as a secondary server using existing tree name URSA. Directory services will be installed, with this server in container O=Novell. This server will have a replica installed, and its bindery will be upgraded.
EraseFile <directory flag>, <var name>, <file spec>, <vol name>, <vol descr>
EraseFile recursively erases the file or directories indicated in <file spec>. Wildcards are acceptable. In NetWare, files can be removed no matter what their attributes; in DOS, only normal files can be removed.
IMPORTANT: Use this command with care to delete only the intended data.
If <directory flag> is 1, <file spec> must be a directory name; the contents of the directory will be deleted, but the directory will not.
If myDir corresponds to VOL1:\.
EraseFile 1, myDir, '', '', ''
The contents of directory VOL1:\ will be erased.
EditNCF <ncf path var>, <ncf file name>, <backup ext>, <ccode>
EditNCF edits the specified NCF file as follows:
GetPath startup, 1, 'C:\\NWSERVER', ''
EditNCF_KEYSTRING ''
EditNCF_KEYSTRING 'PK411.NLM'
EditNCF startup, 'startup.ncf', 'bak', ccode
The contents of C:\NWSERVER\STARTUP.NCF will be searched for a line containing PK411.NLM and will be commented out by the EditNCF command. Ccode will contain the following:
0 - Success
1 - Duplicate Extension
2 - Open Error
3 - Read Error
4 - Write Error
5 - NCF to Backup Extension Error
6 - Tmp to NCF Error
EditNCF_ADDLINE <LineToBeAdded>
EditNCF_ADDLINE adds a line of text to the list of lines to be added at the top of the file being edited with EditNCF.
EditNCF_ADDLINE ''
EditNCF_ADDLINE 'LOAD PK411.NLM'
EditNCF startup, 'startup.ncf', 'bak', ccode
The first line will clear the ADDLINE list. The second line will add the string "LOAD PK411.NLM" to the top of the STARTUP.NCF file.
EditNCF_KEYSTRINGS <keystring>
EditNCF_KEYSTRINGS defines a list of keystrings to be used by EditNCF when determining which lines to comment out. (A line will be commented out if it contains any of the keystrings).
NOTE: The list must be terminated with a null string (empty quotes) for the last entry. This command can be used multiple times. Each time replaces the previously defined list.
EditNCF_KEYSTRINGS ''
EditNCF_KEYSTRINGS 'PK411.NLM', 'ADTRSTFX', 'AUTODUMP', 'CLSSCRFX', 'EAPURGFX', 'EVNTRPFX', 'GETDIRFX', ''
EditNCF startup, 'startup.ncf', 'bak', ccode
The first line clears the KEYSTRING list. The second line adds the strings to the list to be commented out of the STARTUP.NCF file.
ExtractVersionNumbers <version string>, <major var name>, <minor var name>, <revision var name>
ExtractVersionNumbers parses a version string and returns the major version number, minor version number, and revision number as integers. Version string is parsed and leading non-digits are ignored. The variables are filled with the major, minor, and revision values for the version string. If no revision value is in the version string, a zero is returned. If the revision value is a non-digit value, a numeric revision value is returned (i.e., A = 1, B = 2, etc.).
SetVar version, "v2.11"
ExtractVersionNumbers version, major, minor, revision
The variable version contain the string "v2.11". ExtractVersionNumbers returns a value of 2 in the variable major, a value of 11 in the variable minor. And a value of 0 in the variable revision.
FileVersion <src var name>, <src file spec>, <src vol name>, <src descr>, <Module major number>, <Module minor number>, <Module rev number>, <Module description>, <return code>
FileVersion returns the major, minor, and revision numbers as well as the description string of the NetWare Loadable Module (NLM, HAM, CDM, LAN, etc.) as long as the return code is 0.
IMPORTANT: This works only for NetWare Loadable Modules ( that is, it does not work with .EXE or .DLL files, etc.).
GetPath1, 1, 'SYS:\\SYSTEM'
File Version path1, 'DS.NLM', '','', DSMajor, DSMinor, DSRev, DSDesc, DSCode
GetDOSServer <var name>
GetDOSServer returns the default DOS server number in <var name> on SFT* III servers.
GetDOSServer DOSServer
The value of the variable DOSServer will be either 0 or 1. If the value is anything else, the server is not running SFT III.
GetPath <var name>, <path type>, <default>, <prompt>, [<base var name>]
GetPath prompts the user for a path using the prompt. The prompt string will be displayed, with "%s" (like C-language print formatting) being replaced by the <default> string.
The keystrokes to modify will be added to your prompt. Trailing backslashes are always removed before the path is displayed. <var name> is a variable name that can be used later in a CopyFile command. If <prompt> is a null string, the user is not prompted; the path variable is set. If <base var name> exists, it will be used as a basis for the new variable (the remote connection number will be maintained, etc.).
<path type>
Value | Description |
---|---|
1 |
Allow any path. |
2 |
Allow floppy only (including remote). |
3 |
Allow DOS only (including remote). |
4 |
Allow NetWare local path only. |
5 |
Allow local floppy only. |
GetPath input, 1, 'A:', "Files will be copied from %s\\."
The user will see the following prompts:
Files will be copied from A:\
Press <F3> to specify a different path.
Press <F4> to specify a remote path.
Press <Enter> to continue.
Goto <label_name>
Goto causes execution to continue at the first occurrence of label <label_name>.
The scope of a label is always local to a file set. Therefore, a Goto statement cannot transfer execution to a file set different from the current one.
Goto Done
Label Done
The statement Goto Done will cause execution to continue at the label Done.
GotoIfEqual <larg1>, <arg2>, <label_name>
GotoIfEqual causes execution to continue at the first occurrence of Label <label_name> if <arg1> is equal in value to <arg2>. Both <arg1> and <arg2> must be integers.
The scope of a label is always local to a file set. Therefore, a Goto statement cannot transfer execution to a file set different than the current one.
GotoIfEqual 0, 1, Error
Goto Done
Label Error
Since 0 is not equal to 1, execution will not continue at label Error.
NOTE: GotoIfEqual performs an integer comparison, not a string comparison.
GotoIfNEqual <arg1>, <arg2>, <label_name>
GotoIfGreater <arg1>, <arg2>, <label_name>
GotoIfLess <arg1>, <arg2>, <label_name>
GotoIFGrEqual <arg1>, <arg2>, <label_name>
GotoIfLsEqual <arg1>, <arg2>, <label_name>
These are identical to GotoIfEqual, except that execution branches only if (respectively):
<arg1> not equal to <arg2>
<arg1> is greater than <arg2>
<arg1> is less than <arg2>
<arg1> is greater than or equal to <arg2>
<arg1> is less than or equal to <arg2>
The scope of a label is always local to a file set. Therefore, a Goto statement cannot transfer execution to a file set different from the current one.
NOTE: GotoIf* performs an integer comparison, not a string comparison.
Is_NLM_Active <NLM Name>, <Completion Code>
Is_NLM_Active searches the loaded modules list and returns 1 if the NLM is loaded, or 0 if the NLM is not present in memory.
Is_NLM_Active "Monitor.nlm", ccode
IsSubString <string>, <substring>, <index>
IsSubString returns the zero based <index> of <string> where <substring> starts, if <substring> is indeed contained within <string>, otherwise <index> is -1.
IsSubString 'Little Miss Muffet sat on', 'Miss Muffet', index
In this example, <index> would return as 7.
Label <label_name>
Label serves only as a target of a goto statement with <label_name>.
IMPORTANT: The scope of a label is always local to a file set. Therefore, a Goto statement cannot transfer execution to a file set different from the current one.
Goto Done
Label Done
The Goto Done statement will cause execution to continue at Label Done.
LangVar <default>, <lang var>, <src var dir name>, <src vol name>, <src descr>
LangVar sets a variable to the number of a language. It starts with <src var dir name>, then it looks for a subdirectory whose name is a number that matches the current server language number. If the subdirectory is found, <lang var> is set to that number; otherwise, <lang var> is set to <default>.
Assuming the current language is 6:
LangVar 4, lang, NWSRC, '', ''
This command looks in the source install directory for a subdirectory named 6. Finding it, it sets lang to 6.
Menu <var name>, <Prompt>, <# of menu options>, <default menu option>, <first choice>, <first value>, <second option>, <second value> [<third option>, <third value>,] [<fourth option>, <fourth value>]
Menu command will display a window with the <Prompt> showing in a header area. The <choices> will display in a scrolling area below the header. The <# of menu options> is 1 based. The <default menu option> is zero based. The entire command is terminated without a comma after the final value.
Menu done, "Are you ready to continue?", 2, 0,
"Yes", 1,
"No", 0
The Menu command displays a box on the screen with the Prompt "Are you ready to continue?" Below it the choices are "Yes" and "No." The "Yes" option is highlighted as the default option. Upon selecting the option, the value will be placed in the variable. The values must be integers.
NLMExec <block flag>, <command line>
NLMExec executes the NLM specified by <command line>. If <block flag> is 1, NLMExec waits for the NLM to complete execution, then continues. NLMExec is the external command version of the Exec command. NLMExecIO is identical to NLMExec except it executes the command line on the default DOS server on a NetWare SFT III server. See SetDOSServer for more information.
NLMExec 1, PINSTALL
This command executes PINSTALL.NLM and waits for it to finish.
Partitions <delete flag>
Partitions creates NetWare partitions as needed on all available devices. If <delete flag> is 1, all existing non bootable partitions will be deleted. If <delete flag> is 0, they will be left intact. The minimum allowable partition size is 1 MB, according to default rules (see @DeletePartition).
For one existing device with a DOS (active) partition and a NetWare 286 partition:
Partitions 1
This deletes the 286 partition and creates a NetWare partition in the remaining space.
PromptForCD <CD Volume Name>, <seconds to mount>
PromptForCD is to be used with DisMountCD (above). PromptForCD will prompt the user to insert the CD labeled <CD Volume Name> into the CD drive and then will attempt to mount the CD volume within the <seconds to mount> time frame.
PromptForCD 'CD 1', 30
Quit
Quit will exit the script processing at this point. No further processing will take place.
GotoIfEqual %{variable1}, %{true}, Continue_On
Quit
Label Continue_On
ReadProductRecord <productID>, <recordtype>, <recorddatavarname>, <ccode>
ReadProductRecord reads the record in the products database matching the <productID> and <recordtype> specified and returns the corresponding data. This command is the counterpart to the ProductRecord command. See ProductRecord for more information on record types.
ReadProductRecord MYPROD, 0, version, ccode
The command will search the products database and return the value for <version> for product 'MYPROD'.
Read_Var_File <path>, <filename>, <completion code>
Read_Var_File will read the contents of the filename and create variables for script processing. The file is an ASCII formatted file with the content as follows:
"Variable1=true"
"Variable2=false"
"Variable3=Servername"
Read_Var_File "sys:system", "varfile.txt", ccode
NOTE: Ccode will return the file open status. 0 is success, anything else is an error. If the variable to the left contains any spaces, leading or trailing, the spaces will become part of the variable name and must be included with the variable when referencing it.
SetDir <var name>, <relative dir>, <vol name>, <vol descr>, <attributes>, <0|1>, <rights>
SetDir creates directories (if they do not already exist), according to the <var name> obtained from GetPath. The <relative dir> value can be null. <attributes> are the attributes to use when creating the directory; 0 indicates normal attributes. If the <0|1> argument is 1, the server container object (or everyone) is given <rights> rights to the directory.
If myDir corresponds to VOL1:\
SetDir myDir, DOC, '', '', 10, 1, 0
The directory VOL1:\DOC will be created and all applicable users will have rights to it.
SetDOSServer <engine number>, <ccode>
SetDOSServer specifies the <engine number> to be made the default DOS server (valid numbers are 0 and 1). This will set the default server used by the OS APIs.
NOTE: DiskReset and GetPath can be directed to a particular IOEngine by first setting the DOS server as needed. This allows you to essentially map a path variable to a particular IOEngine. From that point on, that path variable will be associated with that IOEngine regardless of what the default DOS server is set to. Therefore, any commands that use path variables will target the IOEngine associated with the path variable rather than the default.
SetVar IOEngineNumber, 0
SetDOSServer IOEngineNumber, ccode
The server's default IOEngine 0 will now be the default DOS server. Ccode will have a 0 for its value on success and a -1 for a failure.
SetLConfigLang <value>
SetLConfigLang looks for the LCONFIG.SYS file in the server boot directory. The default server language ID number is changed to <value>.
SetLConfigLang 9
The default server language ID number in the LCONFIG.SYS file is changed to 9 (Japanese).
SetVar <variable name>, <variable value>, [<Prompt>]
SetVar sets a variable with <variable name> to the <variable value> string value. If the value does not exist, one is created. The variable value cannot exceed 127 characters in length.
SetVar message, "Hello World!"
This causes a variable to be created with name "message," and its value set to the string "Hello World!"
NOTE: The Prompt option is only available in version 3.25+.
The SGotoIf commands have the same options as the GotoIf commands. The SGotoIf commands perform a string comparison instead of an integer comparison.
SpaceCheck <path var name>, <value>
SpaceCheck looks at <path var name>. If it matches a NetWare volume, SpaceCheck checks whether the volume is large enough for <value> bytes, and whether the volume has enough free space for <value> bytes. If the volume is not large enough, the installation aborts. If there is not enough free space, the user is alerted and allowed to continue.
Assuming srcVar corresponds to VOL1:\FILES
SpaceCheck srcVar, 1000000
Volume VOL1: will be checked for one million bytes of free space.
NOTE: ICMD.NLM versions 3.25 and older do not support SpaceCheck on DOS drives. Newer versions support this drive option.
SrchNCF <ncf path var>, <ncf file name>, <keystring>, <foundline var name>
SrchNCF searches an .NCF file for line containing a substring matching <keystring> (non case-sensitive). If found, the line of text will be returned; otherwise <foundline var name> will be empty.
NOTE: The same value as not found will be returned if an error is encountered (for example, invalid filename, read error, etc). It is assumed that this command will be used before calling EditNCF which returns a more detailed completion code that can be acted on as necessary.
GetPath sys, 1, 'SYS:\\', ''
SrchNCF sys, 'SYSTEM\\AUTOEXEC.NCF', "Load Monitor", ccode
The SrchNCF command will search the SYS:\SYSTEM\AUTOEXEC.NCF file for the string 'Load Monitor' and return the line number in ccode if found.
ValueSet <var name>, <value>
Value Add <var name>, <value>
ValueSet sets, and ValueAdd adds to, the numeric contents of variable <var name>.
ValueSet srcVar, 1
The variable srcVar is created if it did not exist and is set to 1.
Volumes <minimum vol SYS: size in sectors>
Volumes creates and mounts volumes on this server, with the volume SYS: placed on the first device larger than <minimum volume SYS: size in sectors> (512 bytes per sector). Additional volumes, named "VOL1", "VOL2", etc., will be created on other devices, one per device.
For one existing device with 50 MB and a NetWare partition, but no volumes:
Volumes 51200; 25 MB minimum
This command creates volume SYS: on the device and mounts it. For more information on creating and mounting NetWare volumes, see the Volume Management API.
Write_Var_File <path>, <filename>, <varname>, <var value>, <completion code>
Write_Var_File will write the varname and var value to the filename specified by the path/filename. The file is an ASCII formatted file with contents as follows:
"Variable1=true"
"Variable2=false"
"Variable3=Servername"
Write_Var_File "sys:system", "varfile.txt", "Variable1", "true", ccode
NOTE: Ccode will return the file open status. 0 is success, anything else is an error. If the variable to the left contains any spaces, leading or trailing, they will be part of the variable name and must be included with the variable when referencing it later. If the filename doesn't exist, it will be created. The varname and var value will then be written. If the file does exist, the varname and var value will be appended to the contents of the file.