Mapping network drives to users in SBS
More often than not it's necessary to map network drives for users at logon in the Small Business Server (SBS) 2000 and 2003. One method commonly used is through the use of batch files, however, there are other ways to accomplish this task.The default SBS login script is located at:
C:\WINDOWS\SYSVOL\sysvol\[domainname].local\scripts\SBS_LOGIN_SCRIPT.batPlease substitute [domainname] for the name of your domain. My domain name is called '2Company' so my path to the login script looks like:
C:\WINDOWS\SYSVOL\sysvol\2company.local\scripts\SBS_LOGIN_SCRIPT.batThis folder is shared as 'NETLOGON', therefore, a quicker method of accessing the 'scripts' folder is via \\[machinename]\\NETLOGON, where [machinename] corresponds to the name of your domain controller.
The contents of SBS_LOGIN_SCRIPT.bat will look something like this (let's assume my domain controller is called PERCY):
\\PERCY\Clients\Setup\setup.exe /s PERCYNote: before modifying this file take a copy of it!
Add the following line to the batch file
\\PERCY\netlogon\MapDrives.batSo your .bat file will now look something like this (I've added comments to it using the REM statement):
REM Default SBS Login ScriptI have also created a MapDrives.bat file with the following lines and placed in the 'scripts' folder:
\\PERCY\Clients\Setup\setup.exe /s PERCY
REM MapDrives Script
\\PERCY\netlogon\MapDrives.bat
Rem Batch File to map drives at loginA few comments about the above:
NET USE z: \\PERCY\Company
NET USE Y: \\PERCY\Software
NET USE X: \\PERCY\Accounts
- You can call different login scripts for different users on the domain by calling a login script using \\PERCY\netlogon\%username%.bat instead of \\PERCY\netlogon\MapDrives.bat
- It is recommended to add each line as a call statement in the default login script, rather than just a line. There is potential with more than 2 lines in the default login script for them not to execute. If you use call you force the focus back to the default logon script after exectution of your new line (see revamped login script below).
- If for some reason there is a previously mapped drive the 'login mapping' as it is will fail. You will need to add the '/DELETE' statement at the end of the 'NET USE' command.
REM Default SBS Login ScriptMapDrives.bat
Call \\PERCY\Clients\Setup\setup.exe /s PERCY
REM MapDrives Script
Call \\PERCY\netlogon\MapDrives.bat
REM %username% script
Call \\PERCY\netlogon\%username%.bat
:End
Rem Batch File to map drives at loginSample %username%.bat file, e.g. percyuser.bat
NET USE z: \\PERCY\Company
NET USE Y: \\PERCY\Software
NET USE X: \\PERCY\Accounts
Rem Batch File to map drives at login for an arbitrary user
NET USE z: \\PERCY\Users\percy.user
Published Tuesday, April 18, 2006

