How convert Local path to UNC on remote machine?

  • Thread starter Thread starter Oleg Cherkasenko
  • Start date Start date
O

Oleg Cherkasenko

User works on machine A and wants copy file to path (for example
"C:\mypath\bin") on machine B.
How can I convert in csharp this path to UNC path? For example
\\B\myshared\\binn"

Thanks.
 
This one uses WMI:

ManagementClass mc = new
ManagementClass(@"\\remote_computer_name\root\cimv2", "Win32_Share", new
ObjectGetOptions());

mc.InvokeMethod("Create", new object[] { @"C:\mypath\bin", "binn", 0, 25,
"Comment goes here..." });

mc.Dispose();

Once run successfully, \\remote_computer_name\binn gives access to the
specified folder. However, you need administror access on the remote
computer make this work.



HTH.

User works on machine A and wants copy file to path (for example
"C:\mypath\bin") on machine B.
How can I convert in csharp this path to UNC path? For example
\\B\myshared\\binn"

Thanks.
 
Back
Top