Setting InheritanceFlags vs PropagationFlags in Powershell

烈酒焚心 提交于 2019-12-06 01:16:43

Calling $acl.SetAccessRuleProtection($true, $false) should prevent that directory or file from inheriting permissions from its parent directory, with the second parameter specifying that the previously-inherited permissions should be removed. Enabling protection = disabling inheritance.

In your New-Ace function, InheritanceFlags specifies to which type of child object (files, directories, or both) the permissions can apply, and PropagationFlags controls whether the permissions apply to this object and/or only immediate children. Neither of these properties affects how this file or directory inherits from its parent.

By the way, PowerShell is built on .NET so the same classes, methods, etc. are available to you, and in some instances the only way to accomplish something that isn't covered by a cmdlet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!