Link to home
Start Free TrialLog in
Avatar of Wayne Viljoen
Wayne Viljoen

asked on

Powershell Script to Add AD Security Group to Shared Folder with Inheritance/Propogation set to "This Folder, Subfolders & Files"

I would like to modify the following Powershell script to add an AD Security Group to a shared folder, but I'd like to also like to set the Inheritance and Propagation flags so that the security group is applied to "This Folder, Subfolder & Files":

$acl = Get-Acl \\OFS1\Data\Accounts

$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("OREP\Custom-ADSecurityGroup","FullControl","Allow")

$acl.SetAccessRule($AccessRule)

$acl | Set-Acl \\OFS1\Data\Accounts


I have seen various references to setting the Propagation=none and Inheritance=Container|Object and that it might be represented as so:

InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit
PropagationFlags.None

I have no idea how to incorporate this into the script above...
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wayne Viljoen
Wayne Viljoen

ASKER

Thanks so much for the clear advice! As usual, the solution was simple!