NetDfsAdd (netapi32)
Last changed: -87.236.26.67

.
Summary
The NetDfsAdd function creates a new Distributed File System (Dfs) link or adds targets to an existing link in a Dfs root.

C# Signature:

[DllImport("Netapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
static extern int NetDfsAdd(
[MarshalAs(UnmanagedType.LPWStr)]
string DfsEntryPath,
[MarshalAs(UnmanagedType.LPWStr)]
string ServerName,
[MarshalAs(UnmanagedType.LPWStr)]
string PathName,
[MarshalAs(UnmanagedType.LPWStr)]
string Comment,
int Flags);

VB Signature:

Declare Function NetDfsAdd Lib "netapi32.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

// DFS_ADD_VOLUME has a value of 1 - see MSDN docs
NetDfsAdd("\\DfsRoot\Path\Dir", "FileServer", "Share", "Comment", 1);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
NetDfsAdd on MSDN

Also on MSDN, there is a more detailed example of using this API:

http://msdn2.microsoft.com/en-us/library/aa380434.aspx