Anyone with more than basic VB skills have 5 min. to help me with a project.

spyordie007

Diamond Member
May 28, 2001
6,229
0
0
I'm exercising my awful VB skills to try and build a little app that will get 2 variables (a username and password) and throw them into 3 commands (that map network drives with the username and password variables). I have a VB project I?ve built in VS.net with the fields/buttons/etc but I cant for the life of me remember (or figure out) how to get the thing to work. Anyone with at least basic VB skills that could both help me with my project and also show me what they did so I can edit it and also do this again on my own next time?

-Spy
 

BennyD

Banned
Sep 1, 2002
2,068
0
0
i have basic vb skills, and just about 5 mins, i'll try to help if i can but i gotta leave for work in 20 mins
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
I imagine you're simply wanting to do a 'net use' with the provided username and password? I don't agree with this solution, but since it's what you requested, do the following:

<codeSnippet language="VB">
Dim sCommand As String
sCommand = "net use drive: \\server\share " & sYourPassword & " /user:" & sYourUsername

Shell sCommand
</codeSnippet>

That's really all you need. Depending on how you want the Shell to execute the command, you may want to tweak the options (to make it minimize so that the command prompt doesn't show, etc.).

Now, a more palatable solution, imo, would be to use the WNetAddConnection2 API call. Here is a decent KB article on how to do this in VB. If you need help with specifics, let me know...
 

spyordie007

Diamond Member
May 28, 2001
6,229
0
0
One specific I'm unsure about, how to I specify the authentication with the WNetAddConnection2 API call?

I think I can handle creating the app with the instructions available on the KB, and could handle adding the username and password fields to the form, just now how to "make them work".

-Spy
 

spyordie007

Diamond Member
May 28, 2001
6,229
0
0
I take that back, I didnt read it close enough. I just wish I had VS with me so I could play with it now...

-Spy