solutions products evaluate support partners about
solutions
products
evaluate
support
partners
about
Using Login Scripts to Deploy the Express Client (ESM 4.x to 5.x)
Technical Note 1340
Last Reviewed 22-Oct-2002

Applies To
Express Software Manager version 4.x through 5.x

Summary
This technical note describes how to modify login scripts to deploy the Express client version 4.x and version 5.x. Sample scripts are provided for Microsoft Windows NT and Novell NetWare 4.x. These scripts are provided for demonstration purposes only and may need to be modified for your network environment.

Note: If you are using Express Software Manager 6.0 or higher, see Technical Note 1595 for details about using login scripts to deploy the Express client.

Deploying the Express Client
Login scripts are the most efficient method of distributing the Express client to user workstations. The basic function of an Express client login script is to run the main executable, Exinst.exe. This executable checks to see if the Express client is already installed on the PC, and if so what version. If no Express client is present, or an update is required, the Express client installation is initialized.

In addition to deploying the Express client, login scripts can be used to logically group users into different Express libraries (to control library size, or to separate logical work units), or to exclude specific workstations from the installation (for dial-in RAS clients, roaming laptop users, or guest accounts). You may choose to group users by name, domain, workgroup name, IP address (using the Express IP Library Locator utility), or other variables. If you choose group users by name and have any roving users, it is recommended that you use the machine name rather than the user name. For more specifics on using the IP Library Locator utility, or detecting RAS connections refer to the Express IP Library Locator, and Detecting RAS sections of this document.

The following sample scripts and related topics are included in this technical note:

  • Windows NT Login Scripts

  • Novell NetWare Login Scripts

  • Express IP Library Locator

  • Detecting RAS

Additional suggestions for simple login scripts can be found in the Deploying the Express Client chapter of the System Administrators Guide.

Using Windows NT Login Scripts
When preparing a Windows NT login script to deploy the Express client, keep these details in mind.

  • For the NT login script to run the user must log in to the NT domain during the Windows logon process.

  • Not all batch processing capabilities are available on all Microsoft Windows platforms, and command syntax may vary by platform. Consider all of the possible Windows operating systems involved when designing an NT login script.

  • The login script is a MS-DOS batch file with a .Cmd or .Bat file extension. The .Cmd extension is run by Windows NT's 32-bit cmd.com, which provides UNC and long filename support. The .bat extension is run by Microsoft's 16-bit command.com and does not support UNC or long file names. A .cmd batch file should only be used if all client PC's are running Windows NT.

  • The login script functionality is limited to those commands available within a Microsoft command or batch file.

  • Several variables can be used in a Windows NT only environment. The most frequently used variables are %OS%, %USERNAME%, %COMPUTERNAME%, and %USERDOMAIN%. If all of the client PCs are running Windows NT server or workstation, the login script can be configured to examine these variables and perform a conditional installation.

  • Another environmental variable, IFMEMBER, is available with the Windows NT Resource Kit. This variable, which can be used only for PCs running Windows NT, determines if a user belongs to a specific domain user group.

Configuring the Windows NT Script to Run
  1. Create a login script using a text editor.

  2. Name the file using the appropriate .cmd or .bat file extension.

  3. Put the login script in the Primary Domain Controller's (PDC) %SYSTEMROOT%\repl\import\scripts folder. (The variable %SYSTEMROOT% refers to the \system32 folder in the Windows NT installation directory).

  4. From a Windows NT Domain Controller, open User Manager for Domains (from Programs, Administrative tools).

  5. Select the user accounts you want to configure to run the login script.

  6. From the menu bar, select User then Properties.

  7. Click the Profile button.

  8. In the Login Script Name field, enter the login script file name.

  9. Click OK to exit User Manager for Domains.

If you have Backup Domain Controllers (BDC), you must replicate this folder from your PDC to all BDCs, or manually copy the login script to each of the BDCs %SYSTEMROOT%\repl\import\scripts folder.

Windows NT Sample Scripts
The following scripts show how to use the Windows NT login script to check for, and respond differently to, various different parameters. These scripts are provided for demonstration purposes only and will need to be modified to fit your specific installation needs and network environment.

Example scripts are provided for the following scenarios.

  • Using Checkras.exe to detect RAS connections

  • Using Ifmember.exe to determine the Windows NT domain group membership

  • Using IP Library Locator to group users into separate Express libraries

  • Using Dosver.com to determine PC operating system

  • Using the PC name to distinguish which PCs should be included in the deployment. There are two sample scripts involved in this process.

Using Checkras.exe to detect RAS connections
REM ***************************************************
REM This sample Windows NT login script uses the Checkras.exe
REM utility from the Microsoft Back Office Resource Kit,
REM volume 2. It performs a check for RAS, then deploys the
REM Express client only if the PC is not using RAS to connect to  
REM the network. This check works only when all workstations are
REM running Windows NT. Note: Checkras.exe must be located in the 
REM login script folder.  
REM ***************************************************
@echo off  
if exist %windir%\system32\RASAPI32.DLL goto Check_RAS 
if exist %windir%\system\RASAPI32.DLL goto CHECK_RAS 
goto NOT_RAS_CLIENT
REM ***************************************************
REM The variable %windir% refers to the Windows installation 
REM directory.
REM ***************************************************

:Check_RAS 
REM ***************************************************
REM You must have Checkras.exe for this program to run.
REM Checkras.exe is part of the Microsoft BackOffice Resource 
REM Kit II.
REM ***************************************************
if exist %windir%\checkras.exe goto RUN_Checkras 
copy  %0\..\checkras.exe %windir% 
REM ***************************************************
REM The variable %0 refers to the directory where the login
REM script is located.
REM ***************************************************


:RUN_Checkras
REM ***************************************************
REM Checking for RAS connection.  If RAS skip to RAS_CLIENT,
REM if not RAS skip to NON_RAS_CLIENT.
REM ***************************************************
%windir%\checkras 
if errorlevel 1 goto RAS_CLIENT

:NON_RAS_CLIENT
REM ***************************************************
REM RAS is not installed or running on this system.  Map a
REM drive to run the installation.  This is not required, but
REM is recommended. This sample script uses the -v and -l 
REM switches. You may want to change the switches to suit your 
REM environment.
REM ***************************************************
net use s: \\servername\libraryfolder\clients
set path=s:\;%path%
s:\exinst -v -l
net use s: /delete
goto end 

:RAS_CLIENT
REM ***************************************************
REM RAS connection detected.  This script jumps to the end 
REM of the script if RAS is detected.  However, you can enter
REM any desired RAS commands here.
REM ***************************************************
:end

Using Ifmember.exe to determine the Windows NT domain group membership
REM ***************************************************
REM This sample Windows NT login script installs the Express
REM client only if the user is a member of Windows NT domain
REM group EXINSTALL_GROUP.  This concept can also be used to set 
REM different domain groups to write to different Express
REM libraries. To use the Ifmember.exe command you must have
REM the Windows NT Resource Kit.  This command works for NT
REM workstations only.  Ifmember.exe needs to reside in the
REM login script folder.
REM ***************************************************
@echo off
REM ***************************************************
REM If the user is a member of the EXINSTALL_GROUP, perform
REM the install. If the user is not a member, no install is 
REM performed.
REM ***************************************************
%0\..\ifmember EXINSTALL_GROUP
if not errorlevel 1 goto end
REM ***************************************************
REM The variable %0 refers to the directory where the login
REM script is located.  Map a drive to run the installation.
REM This is not required, but is recommended. This sample script
REM uses the -v and -l switches. You may want to change the 
REM switches to suit your environment.
REM ***************************************************
net use s: \\servername\libraryfolder\clients
set path=s:\;%path%
s:\exinst -v -l
net use s: /delete
:end

Using IP Library Locator to group users into separate Express libraries
@echo off
REM ***************************************************
REM This sample Windows NT login script uses Exipinst.exe to
REM group users into different Express libraries based on the 
REM workstation’s IP address.  Exipinst.exe replaces exinst.exe 
REM as the client installer.  The library assignments are 
REM established in the Exip.ini file, which is read by
REM Exipinst.exe.  Map a drive to run the installation.  This 
REM is not required, but is recommended.
REM ***************************************************
net use s: \\servername\libraryfolder\clients
set path=s:\;%path%
s:\exipinst -v
net use s: /delete
:end

Using Dosver.com to determine PC operating system
REM ***************************************************
REM This sample Windows NT login script uses the Dosver.com
REM command to determine the PC operating system.  Workstations 
REM are configured to write to different Express Libraries based
REM on the operating system being run. Dosver.com is a Microsoft
REM Utility program that can be obtained from the SMS CD.  
REM Dosver.com must reside in the login script folder.
REM ***************************************************
@echo off
REM ***************************************************
REM Check for client operating system.
REM ***************************************************
if "%OS%"=="Windows_NT" goto NT
%0\..\dosver.com
REM ***************************************************
REM The variable %OS% refers to the local PC’s operating 
REM system. The variable %0 (zero) refers to the directory where 
REM the login script is located.
REM ***************************************************
if errorlevel 7 goto WIN95
if errorlevel 6 goto WIN3X
goto end

:NT
REM ***************************************************
REM Operating system is Windows NT.
REM Map a drive to run the installation.  This is not 
REM required, but is recommended. This sample script uses the -v
REM and -l switches.  You may want to change the switches to suit 
REM your environment.
REM ***************************************************
net use s: \\servername\NTONLY 
set path=s:\;%path%
s:\exinst -v -l
net use s: /delete
goto end

:WIN95
REM ***************************************************
REM Operating system is Windows 95.
REM Map a drive to run the installation.  This is not 
REM required, but is recommended.
REM ***************************************************
net use s: \\servername\WIN95ONLY
set path=s:\;%path%
s:\exinst -v -l
net use s: /delete
goto end

:WIN3X
REM ***************************************************
REM Operating system is Windows 3.1x.
REM Map a drive to run the installation.  This is not 
REM required, but is recommended.
REM ***************************************************
net use s: \\servername\WIN3XONLY
set path=s:\;%path%
s:\exinst -v -l
net use s: /delete
goto end

:end

Using the PC name to distinguish which PCs should be included in the deployment
REM ***************************************************
REM This sample Windows NT login script checks a text file
REM containing the names of PCs authorized to run the Express
REM client.  If the PC name is not in this list, no installation
REM is performed. To use this script you must create this script, 
REM a second script called Computer.bat (sample located 
REM directly after this script), and a text file containing the
REM names of the authorized computers (see computer.bat remarks
REM for further details).  A third bat file called
REM compname.bat is created (on the workstation) and deleted by 
REM the script.
REM ***************************************************
@echo off
REM ***************************************************
REM The %OS% variable works only for PCs running Windows NT, and
REM refers to the local PC operating system.  This variable will 
REM not work when deploying Express to Windows 95, Windows 98,
REM or Windows 3.1x machines.
REM ***************************************************
if "%OS%"=="Windows_NT" set OPTION=workstation 
REM ***************************************************
REM Map a drive to run the installation.  This is not 
REM required, but is recommended.
REM ***************************************************
net use s: \\servername\libraryfolder\clients 
set path=s:\;%path% 
REM ***************************************************
REM To obtain the computer name, run the "net config" command.
REM To extract the computer name, pipe the output to FIND. 
REM The script saves this to a temporary file on the workstation.
REM This sample script writes to the file Compname.bat.
REM ***************************************************
net config %OPTION% | find /i "computer name" > %TMP%\compname.bat
REM ***************************************************
REM The variable %OPTION% determines if the PC is running Windows
REM NT workstation or server.  The variable %TMP refers to the
REM computers local temporary directory.  Compname.bat is created 
REM by the script.  It has one line with three fields: "computer 
REM name \\xxxx", where \\xxxx is the current computer name. 
REM Running compname.bat will run Computer.bat (see below).  
REM ***************************************************
call %TMP%\compname.bat
del %TMP%\compname.bat
net use s: /delete 

Computer.bat
@echo off
REM ***************************************************
REM This script is used in conjunction with the Windows NT login
REM script above, and needs to be located in the same directory.
REM The script also requires the creation of an ASCII text file
REM (computer.txt).  The text file contains a list of PC names of
REM the workstations Express client should be deployed to.  A PC
REM not on this list will be excluded from the deployment.  
REM The format of Computers.txt is :\\computername: (one name per
REM line).  The text file needs to be located in the client 
REM folder on the file server (with exinst.exe).
REM ***************************************************

REM ***************************************************
REM Variable %2 is the computer name. 
REM ***************************************************
find /i ":%2:" s:\computers.txt > nul
if errorlevel 1 goto COMPUTER_NOT_ON_LIST 
if errorlevel 0 goto COMPUTER_ON_LIST

:COMPUTER_ON_LIST
REM ***************************************************
REM If the computer is on the list, install the Express 
REM client now.  This sample script uses the -v and -l switches.
REM You may want to change the switches to suit your environment. 
REM ***************************************************
s:\exinst -v -l
net use s: /delete
goto END 

:COMPUTER_NOT_ON_LIST
REM ***************************************************
REM If the computer is not on the list, end the program 
REM without performing an install.
REM ***************************************************
:END

Using Novell NetWare Login Scripts
Novell NetWare login scripts offer more script flow flexibility (IF, THEN, ELSE commands) than Windows NT login scripts.

Configuring the NetWare Script to Run

  1. Create a login script.

  2. Start the NetWare Administrator.

  3. Select the Organization, Organizational Units or individual user account(s) to which you wish to attach the login script.

  4. With your user choice selected, click the right mouse button and select Details from the popup menu.

  5. Click the Login Script button.

  6. Insert the login script.

  7. Click OK to exit NetWare Administrator.

Novell NetWare Sample Scripts
In the following examples, the variable for the Windows NT condition requires <OS> to be in angle brackets and capitalized. The variable for the Windows 95 and Windows 98 machines only needs to be capitalized. These scripts are provided for demonstration purposes only and will need to be modified to fit your specific installation needs and network environment.

Example scripts are provided for the following scenarios.

  • Installing the Express client in an Windows NT only environment

  • Using the operating system to group users into separate Express libraries

Installing the Express client in an Windows NT only environment
;************************************************************
; This sample Novell login script installs the Express client
; only to Windows NT machines.
;************************************************************
IF <OS>="Windows_NT" THEN
MAP M:=<server name>\<volume>:
#M:\<library path>\CLIENTS\EXINST.EXE -L 
MAP DEL M:
END

Using Novell group membership to group users into separate Express libraries
;************************************************************
; This sample Novell login script installs the Express client
; to workstations. The workstations are grouped into different
; Express libraries depending on the user's Novell group 
; membership.
;************************************************************
IF MEMBER OF ".Expinstall_group1.<ou>.<o>" THEN
MAP M:=<server name>\<volume>:
#M:\<library path>\CLIENTS\EXINST.EXE -Q
MAP DEL M:
ELSE
IF MEMBER OF ".Expinstall_group2.<ou>.<o>" THEN
MAP M:=<server name>\<volume>:
#M:\<different library path>\CLIENTS\EXINST.EXE -Q
MAP DEL M:
END

Using IP Library Locator to group users into separate Express libraries
; ***************************************************
; This sample Novell login script uses Exipinst.exe to
; group users into different Express libraries based on the 
; workstation’s IP address.  Exipinst.exe replaces exinst.exe 
; as the client installer.  The library assignments are 
; established in the Exip.ini file, which is read by
; Exipinst.exe.  Map a drive to run the installation.  This 
; is not required, but is recommended.
; ***************************************************
MAP S:=<servername_volume>:
#S:\<library folder>\CLIENTS\EXIPINST.EXE -V
MAP DEL S:

Installing Express clients into different Express Libraries based on Operating System (with the Novell ZEN client)
; ***************************************************
; This sample Novell login script configures workstations
; to write to different Express Libraries based on the 
; operating system being run.  The PLATFORM variable used
; below is only recognized by the intraNetware (ZEN) Novell 
; client software.  If you are not using ZEN, the next 
; sample script details how to determine the operating
; system without the PLATFORM command.
; ***************************************************
IF PLATFORM="WNT" THEN
MAP S:=<servername_volume>:
S:\NTONLY\CLIENTS\EXINST.EXE -Q
MAP DEL S:
ELSE
IF PLATFORM="W95" THEN
MAP S:=<servername_volume>:
S:\W95ONLY\CLIENTS\EXINST.EXE -Q
MAP DEL S:
ELSE
IF PLATFORM="WIN" THEN
MAP S:=<servername_volume>:
S:\W3XONLY\CLIENTS\EXINST.EXE -QL
MAP DEL S:
END

Installing Express clients into different Express Libraries based on Operating System (without the Novell ZEN client)
; ***************************************************
; This sample Novell login script configures workstations
; to write to different Express Libraries based on the 
; operating system being run.  This script does not use
; the PLATFORM command demonstrated in the prior sample
; script.
; ***************************************************
IF <OS>="Windows_NT" THEN
MAP M:=<server name>\<volume>:
#M:\<library path>\CLIENTS\EXINST.EXE -L 
MAP DEL M:
ELSE
IF OS="WIN95" THEN
MAP M:=<server name>\<volume>:
#M:\<different library path>\CLIENTS\EXINST.EXE -L 
MAP DEL M:
END

Express IP Library Locator Utility
The Express IP Library Locator utility offers a way to group login script users into different libraries based on IP address. The utility can also be used to prevent certain users, such as RAS dial-in users, roaming laptop users, or guest accounts, from installing the Express client based on IP address.

The IP Library Locator executable, exipinst.exe, replaces Exinst.exe in the login script. This executable works only for installing the Express client to 32-bit machines. A 16-bit version of the program available from Express Metrix technical support. For further details on the IP Library Locator, see Technical Note 1072 and the IP Library Locator (For Express Client Installation) section of the Resource Toolkit Utilities chapter in the System Administrator Guide.

Detecting RAS
To avoid installing the Express client over RAS dial-up connections you must to be able to determine how the users are accessing the network. Once a RAS connection has been identified, the script can be configured to prevent the Express client from installing for these logins. Below are four programmatic methods that can be used for RAS detection.

  • The BackOffice Resource Kit II provides a utility called Checkras.exe for NT. Checkras.exe is a routine that returns either 0 or 1 depending on whether the connection is RAS or not.

  • SMS provides a utility that allows the speed of the connection to be checked.

  • Check for environment variable differences between the two login environments and use that to determine access type.

  • If the RAS server has a known range of IP addresses assigned to it, the Express Resource Toolkit IP Library Locator utility can be used to specify a RAS dial-in server's IP address range.

Related Technical Notes
1072 Using the Express IP Library Locator when Deploying the 5.x Express Client
1595 Modifying Login Scripts to Deploy the Express Client (ESM 6.x)
9991 Express Software Manager Technical Notes (5.x or lower)