Pages

Tuesday, November 5, 2013

Keep drive letters consistent for VPN users with this batch file trick

When you have users connecting to your network via VPN, you may want to automatically map drive letters to ensure that the paths are the same for everyone. To do this (when using Microsoft Windows machines), you can use a batch file containing the Net Use command.

For instance, suppose you want everyone to see a certain shared resource as drive p. You could use the following commands:

if exist p: net use p: /delete
net use p: \\[ip address]\[Shared resource] [passwörd]
/user:[domain]\[username] /persistent:No


The first line cancels the connection for anything that's already mapped to drive p. The second line (replacing everything with square brackets with the appropriate information) temporarily maps a shared resource as drive letter p.

Make sure you specify the username and password in the first line where you're accessing a resource.

Note that although the documentation shows the password right after the name of the shared resource, you can also include it after the username.



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.