Nov 16, 2010

Mapping Network Drives on a Stick


This short tutorial will get network drives to map quickly.

The Tutorial

Start by copying this base script into TextPad (or your text editor of choice):
@echo off

echo == Initiating system instance variables...
echo. -- Setting the variables...
set Drives=0
set UserName=
set /P UserName=Username: %=%

echo. -- Running

:: Here you will need to set each of the drives you want to get setup by this script
:: Edit each SUBDOMAIN, DOMAIN, FOLDER, and the drive letter to your needs.
:: /USER:%UserName% should remain as it is

Set /A Drives+=1
echo. Adding drive %Drives%
net use s: \\\FOLDER2 /USER:%UserName%

Set /A Drives+=1
echo. Adding drive %Drives%
net use t: \\\FOLDER2 /USER:%UserName%

:: Repeat the above three lines for as many map drives as needed.

echo. -- Cleaning up...
set UserName=
set Drives=
echo. ++ Done.
Edit the "net use" lines to the folder that needs to be mapped. The drive letter, domain, and folder needs set. "/USER %UserName%" doesn't need edited.

The set of three lines "Set, echo, net" may be repeated for as many files as you need.

Credit Where Credit is Due

Mapping drive letters by garethcummings, getting input from a user by Secret_Doom, and counter incrementing by zrm0008 were all sources used to get this script working.

No comments: