Mapping Universal Drives

Posted: May 1, 2010 in Logon Script with Shell
Tags:


Mapping common drives for all users allows you to present a central resource location for applications or data.  To map a network drive and display the status from the command prompt, proceed as follows:

  1. Create a new directory to store all files included in this example.
  2. Select Start|Run and enter “scriptfile.bat.”

Here, scriptfile is the full path and file name of a script file that contains the following:

@Echo Off

CLS ; Clears the screen

Set Drive=DriveLetter

Set Share=\\server\sharename

Echo Mapping drive %Drive% to %Share%

Net Use %Drive%: /Delete && CLS

Net Use %Drive%: %Share%

If %errorlevel% EQU 0 CLS && Echo Map Successful && Goto End

CLS && Echo Error mapping drive %Drive% to %Share%

:End

Here, driveletter is the drive letter to map a share to, and server contains the sharename you want to map to.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s