Network Administration: Windows Server 2008 Logon Scripts
A logon script 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. For example, 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 is useful if you’ve created a folder for each user and you want to map a drive to each user’s folder. For example:
net use u: \server1users%username%
For example, if a user logs on with the username dlowe, 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, c:WindowsSYSVOLSysvoldomainnameScripts, where domainname is your domain name. Because you frequently need to access this folder, you should create a shortcut to it on your desktop.
After you’ve created a logon script, you can assign it to a user by using the Profile tab of the User Properties dialog box.