question

BrandoNewby-2495 avatar image
0 Votes"
BrandoNewby-2495 asked BrandoNewby-2495 edited

Copying ACL on OU for one Group to another group on same OU

Hello!

I am attempting to copy the ACL on an OU (Test) for Group1 and assign the same permissions to another group (on the same OU).
I need to add Group2 to the OU using the same permissions (ACL) that Group1 has on the Test OU.

I can get Group1 permissions on the OU with:

 $orgunit = "AD:\OU=Test,DC=CCC,DC=DDD,DC=mydomain,DC=com"
    
 (Get-ACL -Path $orgunit).Access | Where-Object {$_.IdentityReference -like "Domain\Group1"}

Group2 is not yet assigned to the OU.
I am having trouble assigning Group2 to the OU while applying the same permissions as Group1. Can anyone please help with this?

I have tried the following:

 $acl = (Get-ACL -Path $orgunit).Access | Where-Object {$_.IdentityReference -like "Domain\Group1"}
    
 Set-ACL -Path $orgunit "AD:\CN=Group2,OU=Groups,OU=AD,DC=DDD,DC=mydomain,DC=com" -aclobject $acl

I know that my variable for $acl is working fine... it's just adding the Group2 to the OU and applying the acl from Group1 to the OU is what's causing me to pull my hair out!!
All help and any suggesitons is greatly appreciated!!!


windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers