r/PowerShell • • Feb 19 '20

Script Sharing Finding GPOs missing permissions that may prevent GPOs from working correctly

Hi guys,

Recently I had another domain (pretty big one actually - 4000 GPOs) that had about 50-100 GPO's broken because of missing permissions.

This blog post talks about it and shows how to fix: https://evotec.xyz/finding-gpos-missing-permissions-that-may-prevent-gpos-from-working-correctly/

It all comes down to running:

Install-Module ADEssentials -Force
$MissingPermissions = Get-WinADGPOMissingPermissions -Mode Either
$MissingPermissions | Format-Table -AutoSize

Here's the output:

This scans the whole forest and all GPO's and searches for Authenticated users or Domain Computers permission missing from GPO's. It only does the scan, I didn't want to fix it. Not today at least.

It requires RSAT (AD+GPO).

Enjoy

157 Upvotes

17 comments sorted by

3

u/Justify_87 Feb 20 '20

Doesn't really work for german AD, I guess. Did u hard-code 'authenticated User' as a name in there?
EDIT: Seems like u did:
https://github.com/EvotecIT/ADEssentials/blob/master/Public/Get-WinADGPOMissingPermissions.ps1

3

u/MadBoyEvo Feb 20 '20

I did, indeed. I'll change it to SID's. Sorry about that.

2

u/Justify_87 Feb 20 '20

No problemo. Thanks for sharing your work

2

u/MadBoyEvo Feb 20 '20

Fixed it. Should work now with SIDs.

6

u/cowmonaut Feb 20 '20

Great, except for when you wanted Authenticated Users gone.

A lot of places split GPOs into User-only and Computer-Only and grant Domain Computers read access and replace Authenticated Users with Domain Users for the User-only GPOs and then replace Authenticated Users with Domain Computers for the Computer-only GPOs.

So if you are in that environment, adjust the script accordingly!

7

u/waikinw Feb 20 '20

Caution for those new with above.

Removing Authenticated Users without adding Domain Computers can cause GPO permission calculation errors.

You can also keep Authenticated Users - Read even even if using User-Only, Computer-Only GPOs unless there's some particular sensitivity issue inside the GPO. You would disable the unused portion Machine or User side. This works because Apply GPO right also is need for it to apply.

I like keeping authenticated users - read as it generally makes reporting and working with the GPOs easier.

https://support.microsoft.com/en-gb/help/3159398/ms16-072-description-of-the-security-update-for-group-policy-june-14-2

1

u/cowmonaut Feb 20 '20

Yes, that's why I said to add that :P

1

u/waikinw Feb 20 '20

Yeps. Cautionary tales bare repeating.

1

u/MadBoyEvo Feb 20 '20

I could probably check for settings (user or computer) and verify accordingly as well.

2

u/msdossys Feb 20 '20

My seniors mind would be blown at anyone running over a few hundred GPOs, he thinks the couple dozen we have make logons slow. Nice little script this ADEssentials!

1

u/MadBoyEvo Feb 20 '20

It's a domain with 50k users. That means there's lot of countries/sites that need something different and that has their own IT who creates GPOs. That's why its so many of GPOs. Not all are linked to single workstation ;)

8

u/Adamj_1 Feb 19 '20

Emin has done this for both reporting, fixing and verification.

https://p0w3rsh3ll.wordpress.com/2016/06/16/fix-gpo-permissions-before-applying-ms16-072/

Great set of snippets.

2

u/majtom Feb 20 '20

Man, i has to do this a few years ago due to Microsoft KB that made them more secure.

1

u/IsThatAll Feb 20 '20

Bloody hell, 4000 GPO's, my condolences.

1

u/Hollow3ddd Feb 20 '20

SOooo much useful stuff from Evotec. I wish I had a large enough environment to need most of it!

-1

u/Dogoodwork Feb 19 '20

Sounds great, I will have to come back here and check it out.

0

u/[deleted] Feb 19 '20

[deleted]

1

u/HeliotOAD Feb 20 '20

Ditto, might run this tomorrow.