top of page

PowerShell | Update Access Control List

Appends the ACL (NTFS) Permissions on a folder. Leaves inheritance in place.

# //// Create the Access Control Entry \\\\
#Assign User or Group

$identity = 'MyNewForest\Shead'
#assign Directory to Change Permissions on
$MyDir = "C:\Temp"
#Set the Rights the Account will have
$rights = 'FullControl'
#Set to allow inheritance still
$inheritance = 'ContainerInherit, ObjectInherit'
#Will Propagate to subfolder as long as inheritance isn't broken
$propagation = 'None'
#Set and Allow vs Disallow
$type = 'Allow'
#builds the Access Control Entry
$ACE = New-Object System.Security.AccessControl.FileSystemAccessRule($identity,$rights,$inheritance,$propagation, $type)
#Pulls in the Current Access Control List
$Acl = Get-Acl -Path $MyDir
#Command to Insert access control entry into current access control list
$Acl.AddAccessRule($ACE)
#Sets the Access Control List onto the Dir
Set-Acl -Path $MyDir -AclObject $Acl
 

ACL.PNG
ACL2.PNG
bottom of page