Skip to content

Instantly share code, notes, and snippets.

@techdecline
Created September 26, 2018 08:46
Show Gist options
  • Select an option

  • Save techdecline/d842b78ece26c4b9d8670f909d986478 to your computer and use it in GitHub Desktop.

Select an option

Save techdecline/d842b78ece26c4b9d8670f909d986478 to your computer and use it in GitHub Desktop.
function Add-NewACE
{
# Fügt einem Objekt eine gewünschte ACE hinzu
param (
[System.IO.DirectoryInfo]$DirectoryItem,
[String]$User,
[System.Security.AccessControl.FileSystemRights]$AccessRule
)
$aclObj = Get-Acl $DirectoryItem
$userpermissions = New-Object System.Security.AccessControl.FileSystemAccessRule($User,$AccessRule, “ContainerInherit, ObjectInherit”, “None”, “Allow”)
$aclObj.AddAccessRule($userpermissions) | Out-Null
Set-Acl $DirectoryItem $aclObj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment