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

Example Logon Scripts

Example 6-1 is a sample ntlogon.bat logon script that is executed when the user logs in to the client running Windows NT.


Example 6-1 Sample nt.logon.bat logon script

REM Sample ntlogon.bat script
net use
REM
REM Set Policy path environment variable
set PCNFSDSERVER=space
set POLICYPATH=\\%PCNFSDSERVER%\opt\MSPolicy
REM
REM Invoke globalboot.bat 
cmd /C %POLICYPATH%\globalboot.bat

The globalboot.bat script in Example 6-2 is called by the ntlogon.bat script.


Example 6-2 globalboot.bat script

REM Sample script to set other environment variables
set VARIABLE1=test
set VARIABLE2=dir
mkdir c:\%VARIABLE1%.%VARIABLE2%
REM
REM Invoke globallogon.bat 
cmd /C %POLICYPATH%\globallogon.bat

The globallogon.bat script in Example 6-3copies files from saturn to the \tmp\planets directory on the client. The following lines in the globallogon.bat script run user Pat's .bat file in the directory \\home\pat on the server named jupiter.

set USER=pat
 set HOME=\\jupiter\home\%USER%
 cmd /C %HOME%\globallogon.bat

To call a logon script for many users, you would need to repeat these lines for each user. If users have identical user names and passwords on UNIX and NT, you can set the built-in NT variable USER to the user's username, and set the variable HOME to the path to the user's home directory on the server, for example, \\jupiter\home\%USER%. The variables %USER% and %USERNAME% are Windows NT variables that dynamically refer to any user.


Example 6-3 Calling a logon Script

REM Sample script to do a copy operation
copy \\saturn\\Dir1\Dir2\*.* c:\tmp\planets
REM
REM Now invoke individual user's logon script
set USER=pat
set HOME=\\jupiter\home\%USER% 
cmd /C %HOME%\%USER%.bat

The script in Example 6-4 runs an executable over NFS.


Example 6-4 Running an Executable over NFS

REM
REM Use predefined NT environment variable
dir %SystemRoot%
REM Remotely run residing executable. 
%HOME%\regmon.exe