windows login script

hello all,

     I would like to ask for a sample window script that shall add a network drive while passing the  username and password, to connect to another computer.  
   
regards,
michelle
LVL 7
manthaneinAsked:
Who is Participating?
 
Christopher McKayConnect With a Mentor Microsoft Network AdministratorCommented:
First thing I'd like to ask, is why you want the batch file to pass the username and password. This leaves this information unprotected and available to be read by others.
Is there any other way to accomplish what you're looking for?

:o)

Bartender_1
0
 
Christopher McKayMicrosoft Network AdministratorCommented:
To pass the information to the net use command, try this:

Net use p: \\<computername>\<sharename> "password" /user:<domain>\<username>

This should work in XP, but once again, the password is stored in the batch file and is readily available to be viewed by all.

:o)

Bartender_1
0
 
sr75Connect With a Mentor Commented:
A vb script would look like this:

Set Net = WScript.CreateObject("WScript.Network")
Net.MapNetworkDrive "Z:", "\\Server\Share", "false", "Username", "Password"

You should then download the Windows Script Encoder from here:

http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp

This will give you a bit more security with your passwords, but it is crackable if the person really want it.

After you install it you run this from the command line:

screnc scripttobeencoded.vbs scriptencoded.vbe

You will need to place the path before each script and possible to the screnc command.

The scriptencoded.vbe is the encoded script.  It cannot be read with just a text editor.
0
 
manthaneinAuthor Commented:
Bartender_1, to answer your question it's because it's just a generic account, and everybody knows the password and the account to be used to map the network drive. I was only trying to prevent  mistyping of the password that would later on make the account to be used locked out. the source computer is included in our domain where I can't set any account  to be unlockable, so the only solution is to create a bat file to connect to the said directory and passing the username and passsword as argument..  
thanks  
0
All Courses

From novice to tech pro — start learning today.