Wednesday, August 18, 2010

Map network drives to Widows 7 automatically

Whenever a user is created on Windows Home Server a user directory is simultaneously created for storing that persons data. I felt like I had been under utilizing my directory and the global "Photos" directory so I decided to setup a few network maps on my laptop and desktop.

This is how I setup my network maps automatically when I log into Windows. It was taken from my previous post on Online Backups for Windows Home Server.


  1. Open your C: drive (or where ever else you'd like to create the batch file).
  2. Create a new batch file and call it whatever you like. I went with "mount.bat". You can do this quickly by creating a text file and then changing the extension from .txt to .bat, assuming you have the option switched to see extensions.
  3. Edit the batch file and add the following code:

echo %date% %time% : "%cd%\mount.bat" >> c:\mount.log

timeout /t 10

echo "Mounting K with \\servername\directoryname" >> c:\mount\mount.log

net use K: \\servername\directoryname /USER:servername\username password /persistent:no >> c:\mount.log 2>&1 2>&1

  1. You'll want to edit the "echo" and "net use" lines so that they match your server name, directory name and administrator's user name. This is where you specify the exact location of the drives you want to mount.
  2. Then you'll want to change "password" to the actual password for you administrator user.
  3. Copy and paste the "echo" line as many times as you'd like to mount as many drives as you'd like. Just remember to repeat the previous steps for each of the lines otherwise you'll be mounting the same drive over and over again!
  4. Save and close your mount.bat file.
  5. Create a task in Windows Scheduler (found in C:\Windows\Tasks) to run your new mount.bat file when the computer starts.
  6. Double click on Add Scheduled Task
  7. Click next and browse to your mount.bat file and open it
  8. You can keep the default name of the schedule but set it to run "When my computer starts" and click next.
  9. Click OK or Apply and when you restart your computer all your drives will be mounted.



That's all there is to it. Now when you log on to your computer you will have a small DOS window pop up and mount your drives. Feel free to change the /t 10 to any amount of time you would like. The lower the value the quicker the DOS window will disappear.

No comments: