To set a new permission using Powershell

PHOTO EMBED

Mon Jul 29 2024 00:35:27 GMT+0000 (Coordinated Universal Time)

Saved by @baamn #powershell

   # Create the new ACE  
   $identity = 'domain\group'  
   $rights = 'FullControl'  
   $type = 'Allow'  
     
   # Folders and files inherit this permission, no need to propagate because it will be inherited  
   $inheritance = 'ContainerInherit, ObjectInherit'  
   $propagate = 'None'  
     
   $ace = New-Object System.Security.AccessControl.FileSystemAccessRule($identity, $rights, $inheritance, $propagate, $type)  
     
   # Apply to existing file system object  
   $acl = Get-Acl -Path 'YourPath'  
   $acl.AddAccessRule($ace)  
   Set-Acl -Path 'YourPath' -AclObject $acl  
content_copyCOPY

https://learn.microsoft.com/en-us/answers/questions/1118931/powershell-on-modifying-permissions