Last active
November 27, 2023 23:00
-
-
Save jszabo98/76c44fd04ee7d9ad831ccf18cd2c1097 to your computer and use it in GitHub Desktop.
acls powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$acl = Get-Acl -Path C:\SpecialFolder\SpecialFile.txt | |
$user = 'BillB' | |
$rights = [System.Security.AccessControl.FileSystemRights]'ReadAndExecute, Write, Modify, Read' # enum flags | |
$rights | |
Modify | |
$RuleBillB = [System.Security.AccessControl.FileSystemAccessRule]::new($user, $rights, 'Allow') | |
$RuleBillB | |
FileSystemRights : Modify, Synchronize | |
AccessControlType : Allow | |
IdentityReference : BillB | |
IsInherited : False | |
InheritanceFlags : None | |
PropagationFlags : None | |
$acl.AddAccesssRule($RuleBillB) | |
Set-Acl -Path C:\SpecialFolder\SpecialFile.txt -AclObject $acl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment