Discussion Locked

VB script problem

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

Is there any way include user name with password to map a network share in VB script. example: username: mejhone password: support, network shard: \\csg_app\merchshare

can this be done?

Thank you.

7 replies

by p.j.hutchison

No I would not recommend to do it that way. Best way is to assign permissions on ther server to allow users access to shares and then map the drive normally.

by rewrite

See this link:

http://visualbasic.ittoolbox.com/documents/document.asp?i=2938

Cheers.

RW

by clark_nick2002

If you put this in your logon script it should do what you want.

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "E:", "\\Your_Server\share_name"

This will use the username and password of the user who is logging on.
you can put "username@domain","password" at the end if you want.

i.e. if you wish to map a share user2 can access but user1 can't to user1's account do the following in user1's logon script

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "E:", "\\Your_Server\share_name","user2@domain","user2_password"

Good luck

This discussion is closed to new replies.