Setting ACL of Directory as Modify with Powershell

You can assign a domain user called FABRIKAM\user_yusufozturk.info to a directory with Powershell:

$LogDir = "C:\inetpub\yusufozturk"
$Account = New-Object System.Security.Principal.Ntaccount("FABRIKAM\user_yusufozturk.info")
$ACL = Get-Acl -Path "$LogDir"
$ACL.SetAccessRuleProtection($True, $True) 
Set-Acl -Path "$LogDir" -AclObject $ACL
$Permission = "$Account","Modify","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir"

You can change Inherit Settings with changing “ObjectInherit”.

Tags: , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply