HOW TO: Reconnect Mapped Drives at Startup
We provide the steps for creating a batch file to disconnect and reconnect mapped drives
Print Friendly View
written: 08/29/2014
last modified: 02/13/2024

Many users experience problems with mapped network drives. The mapped drives do not reconnect correctly after a reboot even when the Reconnect at logon option was set during the mapping of the drive.

One solution is to use the Windows Explorer and browse to the mapped drive. Doing this every time you restart your computer might become annoying, but another solution to this problem is to automatically remap the drives when the computer reboots by using a batch file. This White Paper provides the steps needed for creating this batch file to disconnect and reconnect the mapped drive and for running this batch file from Windows Task Scheduler.

Steps for Creating the Batch File

This example is based on the following variables:

  • The mapped drive letter is “F”
  • The UNC path to map to is “\\MyServer\DataStorage
  • The user name is “Joe”
  • The password is “secret1”

NOTE: These steps entail storing your password as plain text in the batch file.

You can omit the user name and password if you do not require those for establishing the connection. Please refer to the “NET USE” link at the bottom of this article if your mapped network configuration is more complex than this example.

  1. Create a new file using Notepad.
  2. Type:

NET USE F: /DELETE

NET USE F: \\MyServer\DataStorage /user:Joe secret1

  1. Save the file as “MappedDrive.bat”.

Steps for Running the Batch File on Restart

  1. Open Start > Control Panel > Administrative Tools > Task Scheduler
  2. Click on Create Basic Task

  1. Fill in Name field and click Next >.

  1. Select When the computer starts on the Trigger screen and click Next >.

  1. Select Start a program on the Action screen followed by the Next > button.

  1. Use the Browse button to choose the batch file you created in Notepad for the Program/script box on the Start a Program screen then click Next >.

  1. Click the Finish button and you’ve created your task.

For more information about creating a task please refer to “Schedule a Task” link below.

RELATED LINKS

Mapped Drive Connection to Network Share May Be Lost:

http://support.microsoft.com/kb/297684

Schedule a Task:

http://windows.microsoft.com/en-US/windows/schedule-task#1TC=windows-7

NET USE:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx?mfr=true

Attachments
 

Applies To

Category

General Program Information
See more articles in this category