Solved

logon script for two servers

Posted on 2013-06-19
6
423 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

790 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