Solstice NFS Client 3.2 User's Guide for Microsoft Windows 95 and Windows NT

SNC Scripts

SNC scripts are read from an NFS server in the Solstice Network Client network. Using SNC scripts, clients can access system policies, user profiles, logon scripts, and other SNC scripts stored on an NFS server.

In a PC-Admin network, SNC scripts are used to manage and control the environment of PC-Admin clients. These scripts can be adapted to manage Windows 95 and Windows NT client in a Solstice network. The SNC scripts and the script interpreter should be copied to the /opt/MSPolicy directory on the authentication server.

This section:

For detailed information on SNC script directives, turn to Appendix C, SNC Script Directives.

Scripting on PC-Admin and Solstice Network Client Computers

Table 6-1 compares scripting features on PC-Admin client and Solstice Network Client computers.

Table 6-1 Comparison of Features on PC-Admin Client and Solstice Network Client

Script Feature 

PC-Admin Clients 

Solstice Network Clients  

Script server 

Any NFS server designated by DHCP 

A server running the rpc.pcnfsd software.

Location of scripts on the server 

Stored in the DHCP databases. 

\opt\MSPolicy, which is created on the authentication server.

Centralized script management 

Yes 

Yes 

Preemptive logon scripts 

Yes 

Yes 

Supported events 

Login, Logout, Boot, Shutdown 

Login on Windows 95 and Windows NT 

Logout on Windows 95 

Script hierarchy (Site, Group, User) 

Yes 

Yes 

Scripts controlled by environment variables 

Yes 

Yes 

Modification of environment variables 

Local and Global 

Local 

Command to remotely set drive mounts 

MOUNT

MOUNT

Directives (script commands) 

20 script commands for 16-bit client 

20 script commands for 32-bit client 

Global environment variables 

Yes 

Environment can be passed to LAUNCHed applications only.

Support for NIS/NIS+ environment variables 

Current User, Current Group, Secondary Group 

Current User, Current Group, Secondary Group 

 

Running SNC Scripts

If you have created SNC scripts that run in your PC-Admin network, you can run these scripts from any authentication server to manage the 32-bit clients in the Solstice network. The Solstice Network Client software includes a script interpreter (sunwrun.exe) that interprets new SNC scripts or existing PC-Admin SNC scripts. Although there may be minor differences, you should be able to run your existing PC-Admin SNC scripts with no changes. Differences are described in "SNC Scripts on PC-Admin Clients and Solstice NFS Clients".

During installation, the script interpreter is installed on the Solstice Network Client in the directory C:\Program Files\Solstice\Bin\sunwrun.exe. Copy this file to the /opt/MSPolicy directory on the authentication server. The SNC scripts are read from the server and run on the client.

Using SNC scripts, clients can access system policies, user profiles, logon scripts, and other SNC scripts. If you have created scripts for your PC-Admin clients, you can adapt those scripts to run on the client in a Solstice network. To reuse the SNC scripts, use the following procedure.

To Adapt PC-Admin SNC Scripts

  1. Copy the SNC scripts to the /opt/MSPolicy directory on the authentication server.

  2. Rename or copy login.snc to either ntlogon.snc (on Windows NT) or winlogon.snc (on Windows 95).

  3. Rename or copy logout.snc to either ntlogout.snc (on Windows NT) or winlogout.snc (on Windows 95).

Running the Script Interpreter

You can run the script interpreter to develop and debug new scripts. The sunwrun command invokes the script interpreter, which automatically runs the appropriate SNC scripts when the user logs in.

To run the command, type:

sunwrun.exe [-ripn] filename.snc

You can specify multiple file 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.

Available 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 only files 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. 

SNC Scripts on PC-Admin Clients and Solstice NFS Clients

While, for the most part, you can run existing PC-Admin SNC scripts unchanged, there are some differences that you should be aware of.

Ignored Script Directives

The following directives are ignored by the script interpreter.

Command  

Function in PC-Admin 

LOGIN

Starts the Microsoft Windows Login dialog box 

LOGOUT

Logs out current user and set current user ID to nobody

RESERVE

Prevents users from mounting drives 

EXPORT

Copies local to global variables 

STOP

Shuts down client's connection to network 

MOUNT -o preserve

Prevents user from unmounting a drive or printer 

MOUNT -o type

Media type (cdrom or std)

New Script Directives for Windows 95 and Windows NT Clients

New commands are available that enable you to read and write to the system Registry.

Read Values from the Current Registry

The SET REG command enables you to read values from the system Registry into a variable. This is analogous to the SET NIS command. The keys HKEY_LOCAL_MACHINE may be abbreviated to HKLM and HKEY_CURENT_USER may be abbreviated to HKCU.

Write Values to the Registry

The REG directive command enables you to write to the system Registry. This command should be used with great caution.

For example, the command REG NEWKEY keypath creates a new key, and the command REG DELKEY keypath deletes the named key.

NIS and NIS+ Changes

Solstice Network Client supports both NIS and NIS+ on Windows 95 and Windows NT clients. The SET NIS directive looks up values in either or both NIS and NIS+, depending on the configuration of the local machine.

To facilitate backward compatibility, you should use NIS table names, unless you KNOW that you are using NIS+ in native (non-yp) mode. If you are using NIS+, do NOT add the trailing org_dir to the table name.

If NIS+ is enabled, table names are converted according to these rules:

For example,

If you are adapting PC-Admin scripts, note that the return value from NIS+ can be different from NIS, so you may need to use the SET STR command to alter the result.

The SET STR VAR=# %OTHERVAR and SET STR VAR=* %VAR% directives are useful for this purpose. See the description of SNC directives in "SNC Script Directives".

Environment Variables Local to SNC Scripts

Environment variables are handled as in PC-Admin, but are preserved across invocations in the Registry. Exported variables (using the EXPORT directive) are not placed in the Windows global environment. However, any application that is started will have the exported variables set in its environment.

In addition to variables explicitly set in the SNC script, the PC-Admin server sets local variables on clients each time a user logs in. For a list of SNC script variables, see "Environment Variables Local to SNC Scripts".

In general, 32-bit applications should use the system Registry for application-specific data and not rely on the environment.