Batch Scripting at login

fusoniq_solutions used Ask the Experts™
I have to separated domain servers running a peer to peer tunnel with different users on each domain.

I need to create a logon batch scripted on domain1 to be able to mapped a drive on domain2 with the correct credentials eg. username and passwords and domain for for domain2.

At the moment everything l map a drive to domain2 it will ask for credentials for domain2 before l can login to that drive.

Please help
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

You may have to setup domain trust.
To set up explicit trusts among domains in a forest, open MMC snap-in for Active Directory Domains and Trusts. Right-click a domain and open the property sheet. Select the Trusts tab. This tab allows you to add, edit, or delete trust relationships between the selected domain and others in the same forest.

You may refer to 


is there a scripted that will allow me to add credentials?
You can ..... but you are including the credentials in the batch file that anyone can read in plain text form...

net use x: \\server\share /user:otherdomain\theusername password

If you just want the user to specify their password and enter a specific username:

net use x: \\server\share /user:otherdomain\theusername

or their username from this domain on the other domain

net use x: \\server\share /user:otherdomain\%username%

But again.... if you include a password in the file then it is there for all to see.  We do actually do this on one site for a mapped drive for certain people to an iSeries drive but only for a controlled area which is supposed to be accessible to all anyway.



Thanks Steve will give it ago
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Thanks.  Thought I'd added this to my comment at the time -- way of hiding password from immediate viewing by storing usign ADS:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial