search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Setting ACL of Directory as Read And Execute with Powershell
Posted in Hosting & IIS7, Windows Powershell, Windows Server | No Comment | 6,706 views | 27/02/2010 15:48

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","ReadAndExecute","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”.



Leave a Reply