We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adam Bertram
function Get-OrphanedGPO { [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$ForestName ) try { ## Find all domains in the forest $domains = Get-AdForest -Identity $ForestName | Select-Object -ExpandProperty Domains $gpoGuids = @() $sysvolGuids = @() foreach ($domain in $Domains) { $gpoGuids += Get-GPO -All -Domain $domain | Select-Object @{ n='GUID'; e = {$_.Id.ToString()}} | Select-Object -ExpandProperty GUID foreach ($guid in $gpoGuids) { $polPath = "\\$domain\SYSVOL\$domain\Policies" $polFolders = Get-ChildItem $polPath -Exclude 'PolicyDefinitions' | Select-Object -ExpandProperty name foreach ($folder in $polFolders) { $sysvolGuids += $folder -replace '{|}' } } } Compare-Object -ReferenceObject $sysvolGuids -DifferenceObject $gpoGuids | Select-Object -ExpandProperty InputObject } catch { $PSCmdlet.ThrowTerminatingError($_) } }
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
Added more relevant information to the table
Add Find Orphaned GPOs In SYSVOL health check AsBuiltReport#107
ba220fa
Successfully merging a pull request may close this issue.
Adam Bertram
The text was updated successfully, but these errors were encountered: