开发者

Create Network Share with permissions

I didn't find any good info or library on the inet, about how to create a network share and set permission for a local group. I'm using c# and Windows Server 2008.

Does anyone have some good resources or sample开发者_运维知识库 to point me in the right direction?


You can use Pinvoke or WMI,

there is a very nice article on this on Code Project: How to create a file share using .NET framework

the key of the whole thing is the following Windows API:

[DllImport("Netapi32.dll")]
public static extern int NetShareAdd([MarshalAs(UnmanagedType.LPWStr)]
string strServer, Int32 dwLevel, IntPtr buf, IntPtr parm_err);

for using WMI, MSDN "knows": Create method of the Win32_Share Class

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜