I am looking for a map in my program. My users can use every version of Windows with XP. Therefore, I need the most universal method. I used the first method before and, as a rule, it worked well for me. But there really is no way to catch bugs with it (which I know anyway). The second one will easily allow me to wrap a try / catch block around it, but for all the searches that I performed for alternatives to method 1, I only skipped method 2 once. Therefore, I have to wonder if this is enough for such a diverse environment. Can someone tell me if method 2 is safe for most circumstances?
Method 1
Process.Start("net.exe", @"USE Z: \\server\share /user:domain\username password").WaitForExit();
Method 2, referencing the Windows Script Host object model
IWshNetwork_Class network = new IWshNetwork_Class(); network.MapNetworkDrive("k:", @"\\server\share");
source share