【问题标题】:Create Network Share with permissions创建具有权限的网络共享
【发布时间】:2011-09-19 11:29:09
【问题描述】:

我在 inet 上没有找到任何关于如何创建网络共享和为本地组设置权限的好的信息或库。我正在使用 c# 和 Windows Server 2008。

有没有人有一些好的资源或样本可以为我指明正确的方向?

【问题讨论】:

    标签: c# .net network-shares


    【解决方案1】:

    您可以使用 Pinvoke 或 WMI,

    Code Project 上有一篇非常好的文章:How to create a file share using .NET framework

    整个事情的关键是以下 Windows API:

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

    对于使用 WMI,MSDN“知道”:Create method of the Win32_Share Class

    【讨论】:

      猜你喜欢
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      • 2010-09-12
      • 1970-01-01
      • 2011-06-20
      • 1970-01-01
      • 2019-05-01
      • 1970-01-01
      相关资源
      最近更新 更多