This repository was archived by the owner on Jan 21, 2021. It is now read-only.
Fixed edgecase for Find-GPOLocation where GPO is linked to OU but delegated to single computers#242
Open
byt3bl33d3r wants to merge 1 commit intoPowerShellMafia:devfrom
byt3bl33d3r:delegation_fix
Open
Fixed edgecase for Find-GPOLocation where GPO is linked to OU but delegated to single computers#242byt3bl33d3r wants to merge 1 commit intoPowerShellMafia:devfrom byt3bl33d3r:delegation_fix
byt3bl33d3r wants to merge 1 commit intoPowerShellMafia:devfrom
byt3bl33d3r:delegation_fix
Conversation
1. Added the -Full switch to Get-GPODelegation to return full list of GPO delegations 2. Added logic to Find-GPOLocation to deal with edgecase where GPO is linked to OU but delegated only to certain computers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Heya,
During testing, I've noticed that Find-GPOLocation doesn't deal with the edgecase I mentioned in the title (not exactly sure if this is an edgecase), this is what it looks like in the Group Policy Management console:
The GPO is applied to the Computers OU but it's delegated to only to 2 computers so its affectively applied to only them and not the whole OU.
You can follow the article here for the steps to do this so you can reproduce this in a lab.
This PR adds a -Full switch to Get-GPODelegation so it returns all GPO delegations (and not only the ones with 'Write' permissions to users) and some logic to Find-GPOLocation to call Get-GPODelegation and check for this.
This is the cmdlet's output before the fix:
As you can see it returned every computer in the OU.
After the fix:
Let me know how much my code sucks lol
Cheers