Modifying security filtering of a GPO (in bulk)

I recently had to test a few group policy settings on 20 odd machines. When it was time for me to replace the default “Authenticated users” group with my list of 20 computer accounts, i realised there is no easy way of doing. GPMC does not allow adding user or computer accounts in security filtering at once. Adding them one by one is tedious, there’s got be a powershell cmdlet for this. It turns out, it is as simple as using “set-GPPermissions” cmdlet in a foreach loop.

$servers = 'Comp1','Comp2','Comp3','Comp4','Comp10','Comp20'
foreach ($server in $servers) {
Set-GPPermissions -Guid "7131EC6F-6923-4723-86A2-C7C3C5A12057" -PermissionLevel GpoApply -TargetName "$server" -TargetType Computer
}

Be the first to comment

Leave a Reply

Your email address will not be published.


*