Networking

A quick overview of logon scripts in Windows NT

Logon scripts can be very powerful tools to configure your users' workstations when they connect to your network. If you've never worked with them before, read Troy Thompson's quick overview of them in this Daily Feature.


Do you use logon scripts on your Windows NT server? They can be handy tools for automating tasks that you want to occur when your users log on. In this Daily Feature, Troy Thompson gives you a quick overview of logon scripts in Windows NT.

What good are they?
You can configure a logon script to run each time a user logs on. The script file can be a batch file or an executable file. A logon script can be used to synchronize time on a computer, map a network drive, run an antivirus check, etc. A simple logon script might look something like this:
Net use X: \\servername\sharename

This will automatically map a drive X: to the specified server and share when the user logs on. You can create logon scripts using any text editor. Just type the commands you want and save them to a file stored to your login script path.

A logon script path is a local path to the directory where logon scripts are stored. A logon script path cannot be changed from the default on Windows NT, which is usually \%systemroot%\system32\repl\import\scripts.

When a domain controller authenticates a logon request from a user that has a logon script, the system locates the logon script by combining a local logon script path specified in Server Manager with a filename specified in User Manager.

Configuring user accounts to use logon scripts
When users log in, they don’t automatically execute logon scripts that you create. Instead, you must configure the user account to point to the logon script you want to use.

To do so, start the User Manager For Domains by selecting Start | Programs | Administrative Tools (Common) | User Manager For Domains. When the User Manager For Domains window appears, right-click the user account you want to associate with a logon script and click Properties.

When you do, the User Environment Profile screen appears as shown in Figure A. Type the name of the logon script you want the user to execute in the Logon Script Name field. Then, click OK.

Figure A
Type the name of the logon script you want the user to execute in the Logon Script Name field.


In a domain, the master copy of each logon script should be stored under one replication export directory of the primary domain controller or a backup domain controller. From this domain controller, the master logon scripts should be replicated to the other servers of the domain. Each domain controller must have the path to the imported logon scripts entered in Logon Script Path of the Directory Replication dialog box.

You have to use Server Manager to configure a logon script path for a server. Double-click on the server you wish to configure and choose Replication from the property sheet. Type a local path in the Logon Script Path box. An entry is required for this field. Usually, the path will be something like c:\winnt\system32\repl\import\scripts. Click OK to exit when you have entered the required information.
The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.

Editor's Picks