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!

need to run a command from a vb script

Status
Not open for further replies.

1971240z

Technical User
Jul 24, 2002
20
US
I need to run a net use command from a vb script. The script will ask for a users login name as input. Then the user name will be put in to a net use command that will prompt for the users password. This is what I have written.

Option Explicit
Dim name, username
Wscript.StdOut.WriteLine "Enter your name: "
username = Wscript.StdIn.ReadLine

Wscript.StdOut.Run "net use \\55chevy /user:domain\"& username &""

The problem is I do not know how to execute the net use command. Can anyone help?

Regards,
 
You need to specify a drive letter to map, a sharename on the server and a valid domain name:

Wscript.StdOut.Run "net use X: \\55chevy\Sharename /" & username & ":domain\"

Open a command window and type NET USE /? for more info.

Paul Bent
Northwind IT Systems
 
1971240z,
You may benefit from reading faq222-2244, as I notice that you haven't found any of the answers given to you as helpful or expert.
Paragraph 3 will help you find the right forum (this is VB Win32API, you may have got more response in forum329 which is for VBScript)
Paragraph 15 gives ideas on acknowledging answers. Of your 13 questions answered in these forums, you've only bothered to return to 3 of the threads, and you've marked none as helpful

Good luck!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top