Solved

logon script for two servers

Posted on 2013-06-19
6
419 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now