Set ACL of multiple group in AD via POWERSHELL

Leonardo Storelli 21 Reputation points
2020-05-14T15:37:28.57+00:00

Hi everyone
sorry but i'm not very good with Powershell and I need to set the ACL permission for 500 security groups in AD, in particular I should give the rights of; WRITE, READ and DELETE to user TEST1 in all groups that i have exported in TXT file, I cant understand how to set the access rule .. I tried script below but I dont know if its ok

Set-Location AD:\
$groups = Get-Content c:\groups.txt
foreach ($group In $groups) {
$ace = (Get-Acl "AD:$((Get-ADgroup $group).DistinguishedName)").Access
foreach ($acl in $ace) {
$accessrule = New-Object System.Security.AccessControl.ActiceDirectoryAccessRule("domain\test1", "Allow")
$ace.AddAccessRule($accessrule)
Set-Acl -AclObject $ace $group.DistinguishedName -Verbose -Passthru
}
}
thanks

Active Directory Federation Services
Active Directory Federation Services
An Active Directory technology that provides single-sign-on functionality by securely sharing digital identity and entitlement rights across security and enterprise boundaries.
1,292 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pierre Audonnet - MSFT 10,191 Reputation points Microsoft Employee
    2020-05-14T21:41:23.01+00:00

    This section is for AD FS. For AD DS questions, you can use the following forum: https://social.technet.microsoft.com/Forums/en-US/home?forum=winserverDS.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.