Mapped drive

Hello, I have 2 computers that we are trying to have the system map a drive a startup up.
We created a script to use net use to map the drive. If we run the script alone it maps the drive and we have access to the location just fine. We then created a scheduled task to run at startup to call the script. The drive gets mapped, however it does not work, due to a log in error. The server we are trying to map to is on a different domain.

Thanks for the help.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Darius GhassemCommented:
Alright give me the batch file.

Here is an example:

net use * /d

net use k: \\server\share /user:username password
it works as you because you have rights that the system account the script is running under doesnt have.
add domain\user password to the script and yes that could be a security issue having that float around, but there are ways you can address that.

running net use /? will give yo the syntax you need depending on your situation. If the domain is in the same forest, this will work. If not, the trust will need to be established for whatever account the net use command uses.
in the schedule task specify the account that you want to use, (or which you are using to login)
by default it will use system account which will not have access.
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

foster5000Author Commented:
So is the scheduled task credentials over riding the script credentials? and the drive is being mapped with the credentials used to call the script?  

Is there any way around it. the domains are not in the same forets. they are currently totally seperate.
Darius GhassemCommented:
Do you have the credentials in the script? Please post the script
Yes. please put the credentials in the schedule task setting to run the task with.
If the domains are in separate forests, I assume you have a Trust established. You will have to use the exact same account for the script as you use to access the share yourself. Otherwise the trust will have to be modified on both ends potentially.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
foster5000Author Commented:
The issue was with the domains not having a trust relationship. Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.