Set-ACL Permissions

Set File permisions on a directory

http://chrisfederico.wordpress.com/2008/02/01/setting-acl-on-a-file-or-directory-in-powershell/

http://technet.microsoft.com/en-us/library/ff730951.aspx

$acl = Get-Acl c:\temp

$permission = "BuiltIn\Administrators","FullControl","Allow"

$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission

$acl.SetAccessRule($accessRule)

$acl | Set-Acl c:\temp

$colRights = [System.Security.AccessControl.FileSystemRights]"FullControl" 

$InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit,ObjectInherit"  

$PropagationFlag = [System.Security.AccessControl.PropagationFlags]"None"

$objType =[System.Security.AccessControl.AccessControlType]::Allow 

$objGroup = New-Object System.Security.Principal.NTAccount("BuiltIn\Administrators") 

$objACE = New-Object System.Security.AccessControl.FileSystemAccessRule `

    ($objGroup, $colRights, $InheritanceFlag, $PropagationFlag, $objType) 

$objACL = Get-ACL "c:\temp" 

$objACL.AddAccessRule($objACE) 

Set-ACL "c:\temp" $objACL