Skip to content

Instantly share code, notes, and snippets.

@souhaiebtar
Created April 18, 2024 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save souhaiebtar/66c5b8131a37332a611e73d904db659e to your computer and use it in GitHub Desktop.
Save souhaiebtar/66c5b8131a37332a611e73d904db659e to your computer and use it in GitHub Desktop.
[get all permission to folder using powershell] get all permission to folder using powershell #Powershell #Windows #Permissions
$ACLPath = "D:\Users\starhoun"
$Identity = "Users"
$FileSystemRight = "Modify"
$Propagation = "0"
$inheritance = "3"
$RuleType = "Allow"
Try {
$ACL = Get-Acl -Path $ACLPath
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($Identity,$FileSystemRight,$inheritance,$Propagation,$RuleType)
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl -Path $ACLPath
}
Catch {
$ErrorMsg = $_.Exception.Message
Write-Host "Set folder permissions error: $ErrorMsg"
Exit 421
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment