A logon script for Windows Server is a batch file that’s run automatically whenever a user logs on. The most common reason for using a logon script is to map the network shares that the user needs access to. Here’s a simple logon script that maps three network shares:

echo off
net use m: \\server1\shares\admin
net use n: \\server1\shares\mktg
net use o: \\server2\archives

Here, two shares on server1 are mapped to drives M: and N:, and a share on server2 is mapped as drive O:.

If you want, you can use the special variable %username% to get the user’s username. This variable is useful if you created a folder for each user, and you want to map a drive to each user’s folder, as follows:

net use u: \\server1\users\%username%

If a user logs on with the username dlowe, for example, drive U: is mapped to \\server1\users\dlowe.

Scripts should be saved in the Scripts folder, which is buried deep in the bowels of the SYSVOL folder — typically, here:


where domainname is your domain name. Because you need to access this folder frequently, create a shortcut to it on your desktop.

After you create a logon script, you can assign it to a user by using the Profile tab of the User Properties dialog box.