Creating and using a login script

  • Article ID: 13273
  • Rating:
  • 22 customers rated this article 3.5 out of 6
  • Updated: 02 Feb 2012

What is a login script?

A login script is a series of instructions that a workstation follows every time a user logs on. These instructions are held on the server in a 'script' file, which is a batch file that workstations can access and run. A login script allows you to create a single text file containing a set of instructions which are distributed to all the computers that need it.

Why would you use a login script?

There are a number of uses for a login script with Sophos products, for example:

  • to upgrade Windows 95/98/Me computers to the latest version of Sophos Anti-Virus, or install Sophos Anti-Virus in a NetWare environment
  • when using Resolve tools to clean infected computers.

How do you create a login script?

This section outlines the process of creating a login script. Details and commands specific to the type of server you have are given in the Examples section which follows.

  1. At the server which is your (primary) domain controller, navigate to the folder where scripts are held.
  2. Create a new text document or edit the existing one (you can only have one login script).
  3. Enter one or more lines of instructions into the file, and save it as a batch file.
  4. Assign the script to the computers that need to run it. This is usually done by means of the user profile of the person who normally logs in to that workstation.

Example of how to create login scripts

The examples below describe how to create login scripts on the following servers; Windows NT, Windows 2000, Windows 2003, and NetWare. If a login script already exists, you must edit it by adding the necessary commands.

Windows NT

  • Create the login script
  1. At the Primary Domain Controller (i.e. the computer you use to add new users to the domain) use Windows Explorer (or My Computer) to locate C:\Winnt\system32\repl\import\scripts
  2. On the 'File' menu, select New|Text Document.
  3. Double-click the 'New Text Document' icon to open this new file in Notepad.
  4. Enter the required commands.
  5. On the 'File' menu, click 'Save As'. In the 'Save As' dialog box, change 'Save as type' to 'All Files' and save the file with the name login.bat.
  6. Close Notepad and Windows Explorer (or My Computer).
  • Assign the login script
  1. At the taskbar, click Start|Programs|Administrative Tools (Common)|User Manager for Domains.
  2. In the 'User Manager - [your domain]' dialog box, hold down the 'Ctrl' key and click on the users who need the login script assigned to their workstations.
  3. On the 'User' menu, click 'Properties'.
  4. In the 'User Properties' dialog box, click 'Profile'.
  5. In the 'User Environment Profile' dialog box, type 'login.bat' in the 'Login Script Name' text box. Click 'OK'.
  6. In the 'User Properties' dialog box, click 'OK'.
  7. Close the 'User Manager - [your domain]' dialog box.

The next time those users log in, the login script will run on their computers.

Windows 2000

  • Create the login script
  1. At the Domain Controller (i.e. the computer you use to add new users to the domain), use Windows Explorer (or My Computer) to locate C:\Winnt\SYSvol\sysvol\[domain].com\scripts where [domain] is the name of the domain that the workstations log in to.
  2. On the 'File' menu, select New|Text Document.
  3. Double-click the 'New Text Document' icon to open this new file in Notepad.
  4. Enter the required commands.
  5. On the 'File' menu, click 'Save As'. In the 'Save As' dialog box, change 'Save as type' to 'All Files' and save the file with the name login.bat.
  6. Close Notepad and Windows Explorer (or My Computer).
  • Assign the login script
  1. At the taskbar, click Start|Settings|Control Panel.
  2. In the 'Control Panel' window, double-click 'Administrative Tools'.
  3. In the 'Administrative Tools' window, double-click 'Active Directory Users and Computers'.
  4. In the 'Active Directory Users and Computers' window, click the Users folder in the Tree pane.
  5. In the Name list, right-click the name of a user that needs to have the login script assigned to them. In the menu that is displayed, select 'Properties'.
  6. In the '[user] Properties' dialog box (where [user] is the name of the user you right-clicked), click the Profile tab. In the 'Logon script' text box, type 'login.bat'. Click 'OK'.
  7. Now repeat this procedure for each user to whom you want to assign the login script.

The next time those users log in, the login script will run on their computers.

Windows 2003

  • Create the login script
  1. At the Domain Controller (i.e. the computer you use to add new users to the domain), use Windows Explorer (or My Computer) to locate C:\Winnt\SYSvol\sysvol\[domain].com\scripts where [domain] is the name of the domain that the workstations log in to.
  2. On the File menu, select New|Text Document.
  3. Double-click the 'New Text Document' icon to open it in Notepad.
  4. Enter the required commands.
  5. On the 'File' menu, click 'Save As'. In the 'Save As' dialog box, change 'Save as type' to 'All Files' and save the file with the name login.bat.
  6. Close Notepad and Windows Explorer (or My Computer).
  • Assign the login script
  1. At the taskbar, click Start|Settings|Control Panel.
  2. In the 'Control Panel' window, double-click 'Administrative Tools'.
  3. In the 'Administrative Tools' window, double-click 'Active Directory Users and Computers'.
  4. In the 'Active Directory Users and Computers' window, click the Users folder in the Tree pane.
  5. In the Name list, right-click the name of a user that needs to have the login script assigned to them. In the menu that is displayed, select 'Properties'.
  6. In the '[user] Properties' dialog box (where [user] is the name of the user you right-clicked), click the Profile tab. In the 'Logon script' text box, type 'login.bat'. Click 'OK'.
  7. Now repeat this procedure for each user to whom you want to assign the login script.

The next time those users log in, the login script will run on their computers.

NetWare

  1. At a workstation, run Nwadmn32.exe.
  2. In the NetWare Administrator window, right-click your Organization name to display a menu. Select 'Details'. In the Organization dialog box, click 'Login Script'.
  3. Add the required text to the login script.
  4. Click 'OK' and 'Exit' from Nwadmn32.exe.

The next time workstations log on, the login script will run on them.

 
If you need more information or guidance, then please contact technical support.

Rate this article

Very poor Excellent

Comments