且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在PowerShell***享文件夹并设置权限

更新时间:2023-02-01 17:46:51

两个答案.

在PowerShell中,Get-ACL cmdlet将检索现有权限.然后,您可以使用.NET命令修改这些示例,然后运行Set-ACL将其应用回文件夹-这两个cmdlet的帮助包括示例,您可以从www.sapienpress.com下载"Windows PowerShell:TFM"的书籍示例. "=这本书还包含一些明确的例子.

In PowerShell, the Get-ACL cmdlet will retrieve the existing permissions. You then modify those using .NET commands, and run Set-ACL to apply it back to the folder - the help for these two cmdlets includes examples, and you can download the book examples from www.sapienpress.com for "Windows PowerShell: TFM" = the book also contains explicit examples.

但是,这不值得您花费时间.实际上,文件ACL很难处理并且非常复杂.微软已经编写了一些可爱的工具来执行此操作,例如Cacls,而使用这些工具要容易得多.

However, it is not worth your time. Practically speaking, file ACLs are a royal pain to deal with and incredibly complicated. Microsoft has already written lovely tools to do this, like Cacls, and it's far easier just to use those.

现在,所有这些都是FILE权限-您可能还会对更改SHARE本身的权限感兴趣.该工具是SUBINACL,您可以从Microsoft下载它.另请参见 http://cwashington.netreach.net/depo/view.asp?Index = 1127& ScriptType = vbscript .

Now that's all FILE permissions - you may also be interested in changing the permissions on the SHARE itself. The tool for that is SUBINACL, and you can download it from Microsoft. See also http://cwashington.netreach.net/depo/view.asp?Index=1127&ScriptType=vbscript.