Map network drive in C#

// Create network drive mapping

System.Diagnostics.Process.Start(“net.exe”, @”use K: “”\\my.server.com\Websites\Mail“” /user:MyDomain\admin MySuperSecretPassword”).WaitForExit();

// Remove network drive mapping

System.Diagnostics.Process.Start(“net.exe”, @”use K: /delete”).WaitForExit();

Leave a Reply

Your email address will not be published. Required fields are marked *