Results 1 to 3 of 3

Thread: [Solved] Net Use with VB.Net

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2008
    Posts
    48

    [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

    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
    Last edited by Dave_e; Sep 17th, 2009 at 02:17 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width