Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ask for a login pasword and domain name VBscript

Status
Not open for further replies.

1971240z

Technical User
Jul 24, 2002
20
US
I would like to create a script that would prompt for a login name password and domain name. Then it would take the variables and use the net use command to map a drive to a server that was specified in the script. What I have tried is the following:
Option Explicit
Dim name,WshShell,username
set WshShell = WScript.CreateObject("WScript.Shell")
Wscript.StdOut.WriteLine "Enter your name: "
username = Wscript.StdIn.ReadLine

WshShell.run "net use \\server_name /user:domain_name \"& username &""

but it does not work. Can anyone help me fix it?

Regards,
 
Have you tried to play with the InputBox function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes,

I have tried it, but can not get that to work ether
 
What is not working with the InputBox ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
1971240z,

Watch out unwarranted extra space.
[tt]WshShell.run "net use \\server_name /user:domain_name[COLOR=red yellow] [/color]\"& username & ""[/tt] [red]'_wrong_[/red]
(ending "" is useless too).
Should be this.
[tt]WshShell.run "net use \\server_name /user:domain_name\"& username[/tt]

regards - tsuji



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top