Link to home
Start Free TrialLog in
Avatar of scadoosh
scadooshFlag for United States of America

asked on

Mapping Network Drives Across Domains

I need to write a script or cmd that will map a network drive from one domain to another in the same forest. Here is the scenario:

They have one userid and domain they log on to on a daily basis, computer is in that domain.
userid #1:  abcd1    domain:  abcd1
They need to get to a server share on another domain with a different user id and password.  
userid #2:  wxyz1  domain:  wxyz1
It maps just fine and their access has been set up, I just need a script that will log them on to this every day, as they are not logging into the computer with userid #2.  
I have used: "net use w: \\server ip address\share" which does map the drive, but I need it to ask them userid and password to authenticate with the correct user id.

So sorry if confusing.
Avatar of idez_rsp
idez_rsp
Flag of United States of America image

This may not be the answer you're looking for, but...  Your easiest solution is to use the same user/pass on both domains.  It eliminates a lot of confusion for the end users and also the need to reauthenticate.
Optionally you can establish a trust relationship with the other domain so that you can use the existing user credentials to access the share.
Avatar of scadoosh

ASKER

Yes, that would be easiest, but do you know that some companies and people just don't want to do what is easy?
ASKER CERTIFIED SOLUTION
Avatar of idez_rsp
idez_rsp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much, it works like a charm!!  
This should work for multiple users logging on to the same server, as long as the .cmd is edited for their user id, right?
Correct.  The only reason I suggest using the home directory is that scripts appear in clear text for anyone to see.

if you want to get fancy you can do an

if exist \\server\users\%USERNAME%\connect.cmd call \\server\users\%USERNAME%\connect.cmd

This would eliminate the line if the connect.cmd file doesn't exist in the users home directory.

This also assumes the user HAS a home directory set under the users profile settings and that you have the users folder shared as users..