Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 429
  • Last Modified:

logon script for two servers

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
jakester69
Asked:
jakester69
1 Solution
 
Haresh NikumbhCommented:
@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
 
kadafitcdCommented:
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
 
Pete LongConsultantCommented:
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
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
Lee W, MVPTechnology and Business Process AdvisorCommented:
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
 
jakester69Author Commented:
Thanks, it took a bit but I got the script working.
0
 
kadafitcdCommented:
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now