How convert Local path to UNC on remote machine?

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.
 
S

Siva M

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top