You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When run in an environment with GPOs assigned to the root, only GPOs assigned to an OU are found, because it's only looking for GPOs assigned to an OU.
Instead, this enforcement check should be run for all GPOs, regardless of where it is linked.
Here is a quick POC I had to run to get this info in my analysis:
functionIs-GpoEnforced {
param (
[string]$GpoName
)
try {
# Get the specific GPO by name$gpo=Get-GPO-Name $GpoName# Generate a report in XML format for the GPO$reportXml=Get-GPOReport-Guid $gpo.Id-ReportType Xml
# Convert the XML report into an XML object$xmlObj= [xml]$reportXml# Check the NoOverride (enforcement) status of the GPO linksforeach ($linkin$xmlObj.GPO.LinksTo) {
if ($link.NoOverride-eq"true") {
Write-Host"$GpoName is enforced"return$true
}
}
return$false
}
catch {
Write-Warning"Error processing GPO: $GpoName. Error: $_"return$false
}
}
# Get all GPOs in the domain$allGPOs=Get-GPO-All
# Create an empty array to hold enforced GPOs$enforcedGPOs=@()
# Check each GPO for enforcementforeach ($gpoin$allGPOs) {
if (Is-GpoEnforced -GpoName $gpo.DisplayName) {
$enforcedGPOs+=$gpo.DisplayName
}
}
# Output the enforced GPOs as a table$enforcedGPOs|Format-Table-Property @{Label="Enforced GPOs"; Expression={$_}}
First start by getting all GPOs, loop over them to get the xml report, which contains more information than just the enforcement, such as links. To get the enforcement status, use the xml key "NoOverride" in the links section of the xml report.
This approach should ensure that all GPOs that are enforced are included, not just those linked to an OU.
Command-line input
NA
Steps to reproduce
NA to a specific run, just a bug in how the data is gathered.
Expected behaviour
ALL GPOs enforced, not just those enforced at the root
Bug description
The GPO enforcement check considers only GPOs linked to an OU. It does not consider GPOs linked at the root level. This is found in
Get-AbrADGPO.ps1
When run in an environment with GPOs assigned to the root, only GPOs assigned to an OU are found, because it's only looking for GPOs assigned to an OU.
Instead, this enforcement check should be run for all GPOs, regardless of where it is linked.
Here is a quick POC I had to run to get this info in my analysis:
First start by getting all GPOs, loop over them to get the xml report, which contains more information than just the enforcement, such as links. To get the enforcement status, use the xml key "NoOverride" in the links section of the xml report.
This approach should ensure that all GPOs that are enforced are included, not just those linked to an OU.
Command-line input
NA
Steps to reproduce
NA to a specific run, just a bug in how the data is gathered.
Expected behaviour
ALL GPOs enforced, not just those enforced at the root
Screenshots
No response
Operating System
2019 Server
PowerShell Version
PS7
PowerShell Modules
NA
Additional Context
No response
Before submitting
The text was updated successfully, but these errors were encountered: