创建网络共享与权限 [英] Create Network Share with permissions

查看:156
本文介绍了创建网络共享与权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有发现任何好的信息或库在INET,关于如何创建一个网络共享,并设置权限的本地组。我使用C#和Windows Server 2008。

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?

推荐答案

您可以使用的PInvoke或WMI,

You can use Pinvoke or WMI,

上有code项目上这是一个非常不错的文章:如何使用创建文件共享.NET框架

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

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

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);

有关使用WMI,MSDN知道:的创建Win32_Share类方法

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

这篇关于创建网络共享与权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆