Solved

logon script for two servers

Posted on 2013-06-19
6
424 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 250 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 57

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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 95

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Having a different time zone on your task bar 3 77
Is IHttpActionResult a promise pattern? 2 74
Computers reporting Windows patches applied 14 148
how to count files? 4 49
The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
This collection of functions covers all the normal rounding methods of just about any numeric value.
Viewers will learn the different options available in the Backstage view in Excel 2013.
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…

685 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