[Solved] Net Use with VB.Net
Hi
I'm trying to map a network drive within VB.Net and not sure how close I am to achieving it :confused:
I basically want to do this (which can be done from a command prompt)
net use s: \\Volume\Directory
and tried to do it by using this code
Code:
Dim startInfo As System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process
startInfo = New System.Diagnostics.ProcessStartInfo("net use s: \\Volume\Directory")
pStart.StartInfo = startInfo
pStart.Start()
This doesn't work, I get an error on the Process Start.
I then found this code on MSDN but it's for C#
Code:
System.Diagnostics.ProcessStartInfo processInfo = new System.Diagnostics.ProcessStartInfo();
processInfo.FileName = @"C:\WINDOWS\system32\net";
processInfo.Arguments = @"use X: \\MYPC\Folder /USER:MYPC\TEST P@ssw0rd";
System.Diagnostics.Process.Start(processInfo);
I've tried to translate, but not getting anywhere ...
Can someone please help?
Thanks