Network Administration: Windows Server Logon Scripts
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: \server1sharesadmin net use n: \server1sharesmktg net use o: \server2archives
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: \server1users%username%
If a user logs on with the username dlowe, for example, drive U: is mapped to \server1usersdlowe.
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.