// 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();

One Comment

  1. Nice. I had old code that was using the Windows Script Host interop to map drives that was acting buggy after users switched from Windows 7 to 10. I tried your approach with much better success. Thanks

    Rick

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.