?
Solved

logon script for two servers

Posted on 2013-06-19
6
Medium Priority
?
431 Views
Last Modified: 2013-06-19
I tried to search for the answer to this but I can't find much.  I am using a logon script to map new computers to the network drive.  The one I use works but the passwords to the servers are required each time you restart the computer.  This is annoying and I don't want everyone to do this.  I copied a sample of my script below but I'm hoping someone can help me in setting the server passwords.  You can probably see I have two servers.


echo off
net time \\"server1name" /set /yes
net time \\"server2name" /set /yes
net use g: \\"sever1name"\"serverdrive"
net use h: \\"sever2name"\"serverdrive"
0
Comment
Question by:jakester69
6 Comments
 
LVL 22

Accepted Solution

by:
Haresh Nikumbh earned 750 total points
ID: 39259400
@echo off

set /p uname=Username:

set /p pswd=password:

net use z: \\srv\drive /u:your-domain\%uname% %pswd%

***** keep in mind, that in this way a password seen as a plain text. *****

source:

http://social.technet.microsoft.com/Forums/scriptcenter/en-US/4ca0fc64-657a-41eb-8ecb-717a8ab32e05/logon-script-map-network-drive
0
 
LVL 12

Expert Comment

by:kadafitcd
ID: 39259452
Have you set the permissions up to the server1drive and server2drive to allow the users to connect to them with their own user account or are you using an admin account to connect to them?  

I would suggest setting the permissions to allow the user accounts access and then you shouldn't be asked to login to the server anymore as you've already logged into the domain when you sign onto the computer.  That will avoid having to use passwords in plain text showing the inquisitive end user the server password.

If you need help setting up the permissions let me know.
0
 
LVL 58

Expert Comment

by:Pete Long
ID: 39259459
Why set your time against one server, then instantly set it against another one?

Bear in mind is your in a domain your clients take their time from the PDC emulator anyway?

but to map the drives

net use g: "\\sever1name\Serverdrive" Password123 /U:DOMAIN-NAME\user-name
net use h: "\\sever2name\Serverdrive" Password123 /U:DOMAIN-NAME\user-name
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
LVL 97

Expert Comment

by:Lee W, MVP
ID: 39259462
If you're users are logging in to a domain, then the passwords should not be prompted for - the users passwords are used.

Further, you should not be putting names of servers and shares in quotes:

Finally, there is no point in setting the time TWICE as the second line is overriding the first line.  (And technically, the NET TIME command is unnecessary as a Windows Domain has a time service and the systems should be getting their time from the DC with the PDC emulator role.

echo off
net use g: \\sever1name\serverdrive
net use h: \\sever2name\serverdrive

Otherwise, if you insist on doing things the way you want, you will be storing the password for a user in a plain text file that anyone can see.

net use g: \\sever1name\serverdrive password DomainOrComputerName\username
net use h: \\sever2name\serverdrive password DomainOrComputerName\username
0
 

Author Closing Comment

by:jakester69
ID: 39259724
Thanks, it took a bit but I got the script working.
0
 
LVL 12

Expert Comment

by:kadafitcd
ID: 39259829
Jakester69.  I understand you wanting to use the quick fix here.  But please keep in mind that you are taking a big risk leaving your Server password out there in the open like this.  As an admin of systems you should never do this.  I would recommend giving our other recommendations a try to see if you can make it work.  If not and if you think it's not worth your time then fine but you should try to avoid the giant security breach your have setup with the script...
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This collection of functions covers all the normal rounding methods of just about any numeric value.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month4 days, 9 hours left to enroll

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question