Solstice Network Client includes a script interpreter, sunwrun.exe, that is installed into the directory C:\Program Files\Solstice\Bin during client installation. Since the script interpreter is designed to be read from the server, the system administrator should copy this file from the directory on the client to the /opt/MSPolicy directory on the authentication servers (servers running the rpc.pcnfsd daemon). Installing the script interpreter enables the network administrator to use new SNC scripts or pre-existing PC-Admin SNC scripts with the 32-bit clients running Solstice Network Client software.
The SNC script interpreter runs automatically at login on a Windows NT or Windows 95 system and at logout on a Window 95 system. The script interpreter interprets the SNC directives, which are, with a few exceptions, identical to the PC-Admin SNC directives. The script directives are listed and described in "SNC Script Directives".
The syntax of the sunwrun.exe command is:
[drive:[path]]sunwrun.exe [-ripn] [drive:[path]]file.snc
You can specify multiple script file names on the command line. Each file name must end with the .snc extension. The interpreter will execute each file, in order, until a script exits with a non-zero exit code or all files are processed.
Options include:
-r |
Causes the script interpreter to reset the shared environment before interpreting the first file. |
-i |
Causes the script interpreter to reset the shared environment after interpreting the last file. |
-p |
Causes the script interpreter to execute files only from the location specified in the SNDRIVE variable. |
-n |
Causes the script interpreter to exit immediately after executing the last script file, rather than waiting the default 5 seconds provided to enable the user to view the output. |
The SNC script directives are commands that are interpreted by the script interpreter. The directives are listed alphabetically and described in this section.
Copies a file to a new location. You cannot use wildcards when specifying the source file name. If destination_file is a directory, the file is copied into the directory with the same name.
Example:
This example copies the Netscape bookmark file from a user's client computer to the user's home directory on the server.
COPY D:\Program Files\Solstice\Netscape\bookmark.htm %SNHOME%
Deletes a list of files, directories, or both. A directory must be empty before you delete it. No wildcards apply in specifying the name of files or directories to delete.
Example:
This example deletes the temp directory from your hard disk and home directory.
DELETE C:\temp %SNHOME%temp
Turns the interpreter line echo on or off, or displays text_string. ECHO operates like the DOS batch file ECHO. Each ECHO updates a scrolling dialog box. ECHO ON displays all lines as they are interpreted, including REM statements. The dialog box is displayed upon the first ECHO text statement and closes when the interpreter exits.
Ends the interpretation of an SNC script. The numeric exit_value is returned to the calling SNC script. You can test the ERRORLEVEL with the IF directive.
Example:
This example exits the current SNC script with an ERRORLEVEL value of 3.
EXIT 3
Puts the variable varname into the environment of the script interpreter. Exported values are then available to the launched program. Environment variables are preserved across invocations in the registry.
The exported variables are not placed in the Windows global environment. However, any application that is launched or otherwise started, will have exported variables set in its environment.
In general, 32-bit applications should be using the registry for application-specific data and not relying on the environment.
Example:
This example exports the variable name, PATH.
EXPORT PATH
Jumps to a different location within the current SNC script. The label is a string. The location to jump to is denoted by :label on a line by itself.
Example:
This example goes to the line with the continue label if ERRORLEVEL is 0.
IF ERRORLEVEL 0 GOTO continue ECHO "help, an error occurred!" EXIT 1 :continue ECHO "Success!"
Conditionally controls the interpretation of statement based on the value of condition.
Condition |
Value |
---|---|
EXIST filename |
True if filename exists; false otherwise. Example: IF EXIST temp DELETE temp Deletes the file temp if it exists. |
ERRORLEVEL number |
True if current error level is equal to number. Example: IF ERRORLEVEL 0 GOTO label |
"string1" == "string2" |
True if the strings match. Strings can contain a variable, such as %SNUSER%, which is expanded before testing for a match. Strings can also contain a literal % by having two %% in a literal--the first % escapes the second %. Exampl:e IF "%SNUSER%" == "root" EXIT If the user is root, then exit. |
Includes and interprets another SNC script. snc_filename is a fully qualified path to the file.
ERRORLEVEL is set upon returning from interpreting the listed SNC script if an error occurs or the EXIT directive is used.
Example:
This example includes and interprets the script test.snc.
INCLUDE C:\windows\test.snc
Adds, changes, or deletes entries or sections in the specified .INI file. In a single INI directive, you can add an entry to a section, or add a section and an entry. You can also delete a section, or delete an entry in a section.
In general, 32-bit applications should be using the Registry for application-specific data and not relying on the .INI files.
Example:
This example deletes the [nfsw] section in the SYSTEM.INI file.
INI C:\windows\system.ini nfsw
Example:
This example creates an app section in the WIN.INI file if it does not exist, and creates the Flag1 entry.
INI C:\windows\win.ini app Flag1=1
Specifies a file to be launched just before exiting the SNC script, where filename is a fully qualified path to the file, and options are any options the file may call.
If there are multiple LAUNCH directives, the last one takes effect.
No exit status is returned, except that ERRORLEVEL is set if the interpreter fails to find or execute the listed argument.
Example:
This example launches winipcg.exe file after it has processed the script.
LAUNCH C:\windows\winipcg.exe
Is parsed, but ignored.
Is parsed, but ignored.
Creates one or more directories. All directories in the path to a directory being created must exist. However, in a single directive, you can create a directory, then create a directory below it, and so on, by entering multiple arguments in order.
Example:
This example creates the directory C:\able\baker\charlie.
MKDIR C:\able C:\able\baker C:\able\baker\charlie
NFS mounts a remote file system on the drive letter drive. The -o option can be followed by the options listed below, separated by commas.
Without options, the DRIVE directive lists the mounted drives.
The options are:
Option (Type) |
Description |
---|---|
acdmax (INTEGER) |
Sets the maximum number of seconds that NFS waits before checking to see if a folder attribute, such as modification time, has changed. A smaller value assures earlier detection that a folder has been modified. A larger value improves performance by decreasing the frequency of NFS operations. |
acdmin (INTEGER) |
Sets the minimum number of seconds that NFS waits before checking to see if a folder attribute, such as modification time, has changed. A smaller value assures earlier detection that a folder has been modified. A larger value improves performance by decreasing the frequency of NFS operations. |
acoff (BOOLEAN) |
Disables attribute caching. Caching can improve NFS file access time. |
arch (BOOLEAN) |
To conform to DOS conventions, you can set the archive bit to true. |
acrmax (INTEGER) |
Sets the maximum number of seconds that NFS waits before checking to see if a file attribute, such as file size, has changed. A smaller value assures earlier detection that a file has been modified. A larger value improves performance by decreasing the frequency of NFS operations. |
acrmin (INTEGER) |
Sets the minimum number of seconds that NFS waits before checking to see if a file attribute, such as file size, has changed. A smaller value assures earlier detection that a folder has been modified. A larger value improves performance by decreasing the frequency of NFS operations. |
bsd (BOOLEAN) |
Uses BSD directory folder creation syntax. |
case=[yes, no] |
Handles remote drive with case sensitivity in file names. Default is no case sensitivity. case=yes automatically sets cs (case sensitive). case=no automatically clears cs. |
cf (BOOLEAN) |
Uses only the preferred case (either upper or lower) for file name operations. If not specified, you can create files and folders in either uppercase or lowercase. Specifying cu and cf forces uppercase. If both options are specified, when created, the folder myfolder is automatically changed to MYFOLDER. |
cs (BOOLEAN) |
Looks up file names while preserving the case in which you entered the file name search key. When this option is used, file operations are case sensitive, which is faster than case-insensitive operations. |
cu (BOOLEAN) |
Instructs NFS Client to use uppercase letters as the preferred case for looking up and creating file names. |
lock (BOOLEAN) |
Specifies whether to use the built-in NFS capability to prevent others from changing files you are modifying. The default is no. |
map=mapchar |
Specifies a file name mapping character. Example: map=^ |
nfsver (INTEGER) |
Specifies which version of NFS to use (0, 2, or 3). If the servers to which you most often connect support only one version, configure that version as a default. The default value 0 automatically tries v3 first and then v2. Example: nfsver=2 specifies NFS v2 |
port (INTEGER) |
Default is 2049. The NFS specification suggests port number 2049 as the standard NFS server port. Your NFS servers may be configured to use another port number. |
preserve |
This option is ignored |
retries (INTEGER) |
Specifies the number of times an NFS client attempts to reach an NFS server. The default value is 5. |
ro | rw |
Mounts the directory in read-only or in read-write mode. Default is rw. The ro option connects drives so that you can read, but cannot write, their files. |
rsize (INTEGER) |
Specifies the size (in bytes) of a data block read from a file during an NFS data transfer. A larger size increases NFS performance if the underlying network hardware can handle the larger size. The default read and write size is 32,768 bytes for TCP, and 8 kilobytes for UDP. Example: This example sets the read size to 1024 bytes. rsize=1024 |
share=[yes, no] |
Specifies whether to use the built-in NFS capability to prevent others from changing files that you are modifying. The default is no. share=yes automatically sets lock. share=no automatically clears lock. |
trans [TCP|UDP] |
Specifies transport. Using the UDP transport speeds up network traffic by reducing packet overhead. TCP works better when high reliability of packet transmissions is a requirement. If not set, the NFS client tries TCP first and then UDP. Example: trans=TCP sets the transport to TCP. |
type |
This option is ignored |
umask |
Sets the file creation mask. Example: umask=022 |
wsize |
Specifies the size (in bytes) of a data block written to a file during an NFS data transfer. A larger size increases NFS performance if the underlying network hardware can handle the larger size. The default read and write size is 32,768 bytes for TCP, and 8 kilobytes for UDP. Example: wsize=8192, sets the write size to 8192 bytes. |
Example:
The following example mounts the directory saturn:/usr on drive U, read-only, with a read size of 8 Kbytes, and with at least 10 retries before failing an NFS operation.
MOUNT -o ro,rsize=8192,retries=10 DRIVE saturn:/usr U:
Is parsed, but ignored.
Suspends the processing for number seconds.
Example:
This example sets a pause of 5 seconds.
PAUSE 5
Deletes the named Registry key, keypath. This directive fails if there are subkeys.
If keypath contains spaces, enclose them in quotes.
keypath is the full path to the key containing the value. You can abbreviate HKEY_LOCAL_MACHINE to HKLM and HKEY_CURRENT_USER to HKCU.
Example:
This example deletes the named Registry key.
REG DELKEY HKEY_CURRENT_USER\Software\Netscape\MyKey
Deletes the value value_name in the Registry key keypath.
If keypath or value_name contain spaces, enclose them in quotes.
keypath is the full path to the key containing the value. You can abbreviate HKEY_LOCAL_MACHINE to HKLM and HKEY_CURRENT_USER to HKCU.
Example:
This example deletes Myval in the named Registry key.
REG DELVAL HKEY_CURRENT_USER\Software\Netscape\MyKey MyVal
Creates a new Registry key at the path keypath.
If keypath contains spaces, enclose them in quotes.
keypath is the full path to the key containing the value. You can abbreviate HKEY_LOCAL_MACHINE to HKLM and HKEY_CURRENT_USER to HKCU.
Example:
This example creates a new Registry key called: HKEY_CURRENT_USER\Software\Netscape\MyKey
REG NEWKEY HKEY_CURRENT_USER\Software\Netscape\MyKey
Adds a new value called value_name, of the specified type in the Registry.
If keypath or value_name contain spaces, enclose them in quotes.
keypath is the full path to the key containing the value. You can abbreviate HKEY_LOCAL_MACHINE to HKLM and HKEY_CURRENT_USER to HKCU.
type can be BINARY, MULTI, STRING, WORD.
Type |
Meaning |
---|---|
BINARY |
Specifies a string of twin hexadecimal values. (Registry type REG_BINARY) Example:
REG BINARY HKCU\Software\sunw\cc\1.0\sunwnfs Binary_test 7465737400 |
MULTI |
Specifies a set of strings separated by spaces. (Registry type REG_MULTI_SZ) Example:
REG MULTI HKEY_CURRENT_USER\Software\Netscape\MyKey Srtings "My telephone number is 1234567" adds the strings My, telephone, number, is, and 234567 to the value Strings. |
STRING |
Specifies a string. (Registry type REG_SZ) Example:
REG STRING HKEY_CURRENT_USER\Software\Netscape\MyKey test Hello adds the string Hello to the value test. |
WORD |
Specifies a integer in decimal or hexadecimal format. (Registry type REG_DWORD) Note: When a decimal number is entered it will be converted to hexadecimal and stored. When read back it will be in hexadecimal format, and leading zeros will be added to look exactly as it does in the Registry. Example of writing a decimal value:
REG WORD HKCU\software\netscape\MYKey MyValue 4294967295 SET errorcode=%SNERRORLEVEL% IF NOT "%ERRORCODE%" == 0 GOTO ERROR Example of reading the same value:
SET REG readvalue=HKCU\software\netscape\MyKey MyValue NOTSET IF NOT ERRORLEVEL 0 GOTO ERROR2 ECHO Value read is "%READVALUE%" |
Specifies a comment line.
Example:
This example adds the comment, "Set environment variable."
REM Set environment variable.
Is parsed, but ignored.
Sets the environment variable named varname with the value obtained from value_source according to value_specifier.
value_source can be ABS, INI, NIS, REG, or STR.
This directive is parsed, but ignored.
Changes the file creation mask for the current user.
If the UMASK directive is used, then the value supplied is used as the default umask for all drive mounts. If it is not supplied, the system-wide default is used.
The umask setting may be overwritten on a per-mount basis, using the umask option to the MOUNT command.
Example:
This example changes the umask to 022.
UMASK 022
Unmounts a network drive or printer.
Example:
This example unmounts the directory mounted on drive U.
UNMOUNT DRIVE U:
The following table lists the environment variables set on Solstice Network Client computers.
These variables are available to the SNC scripts and are saved in HKCU\Software\SUNW\CC\1.0\sunwnfs\Environment.
Variable |
Value |
---|---|
SNCLASSID |
Not used. |
SNCLIENTID |
Not used. |
SNDRIVE |
Drive letter of the drive where the directory /opt/MSPolicy is mounted. |
SNERRORLEVEL |
The error level returned by any SNC script directive. You must capture this value in the next directive, or it will be lost (overwritten). |
SNGROUP |
Current user's UNIX primary group name. Numeric versions of this variable are available for systems not running NIS or NIS+. |
SNGROUPS |
Current user's UNIX secondary group names. Numeric versions of this variable are available for systems not running NIS or NIS+. |
SNHOME |
Current user's home directory on the server. |
SNHOSTIPADDR |
The IP address of the client. The SNHOSTNAME variable is always set to the Computer Name in the Network Identification property page, while SNHOSTIPADDR is always set to the IP address assigned to the client computer, even when using DHCP. |
SNHOSTNAME |
Client machine name. |
SN_SERVER |
Server that authenticates the user at login. |
SNUSER |
Current user's UNIX login name. |
SNVERSION |
Version of script interpreter. |