Joseph DeVore's Blog: Windows Server


Viewing By Category : Windows Server / Main
June 14, 2008
Sometimes you need your server to reconnect a mapped drive using a different login after it’s been rebooted and you can't wait for a user to log in and physically reconnect using different credentials.

With the following code, the server automatically reconnects and makes the connection persistent. I have found this to be very useful when you want to access a remote server using a drive letter (D:\) over a UNC path (\\host\share) that requires a different username and password.

To automate this reconnection, create a new text file called mapped_drive.bat (or something similar, just make sure the file extension is .bat)

Add the following code after replacing the place holders:

  • {drive letter} is the letter of the drive that you want to reference.
  • {host} is the name or IP of the server.
  • {share} is the shared directory on the remote machine.
  • {username} to access the server share on the remote machine.
  • {password} to access the server share on the remote machine.

net use {drive letter}: \\{host}\{share}/USER:{username} {password}
net use /PERSISTENT:YES

Comments

Comments are not allowed for this entry.













Editor Login ›