What's the best way to effect a "net use" from C#? I need to be able to establish named drives, passing the user name and password. AndAlso of course remove said mappings. In other words I'd like to be able to carry out variations on a theme of:

   net use q: \\SomeServer\SomeShare foo /user:bar


   net use /d q:

One way of doing this might be to use System.Diagnostics.Process and redirect the stdout and stderr so I can parse any output to delivery decent structured error messages that my code can act upon. However that seems a little clunky. I'd really rather PInvoke a set of APIs than "shell out". Anyone got any thoughts?

Cheers - tom.