Project

GPOZaurr

GPOZaurr helps inspect, report on, and remediate Group Policy environments with PowerShell.

Stars 1,250
Forks 119
Open issues 15
PowerShell Gallery downloads 421,558
Release v1.1.11
Language: PowerShell Updated: 2026-10-09
Command

Remove-GPOZaurrDuplicateObject

Module GPOZaurr

Removes duplicate Group Policy Objects (GPOs) identified by the Get-GPOZaurrDuplicateObject function.

Syntax

Remove-GPOZaurrDuplicateObject [[-ExcludeDomains] <String[]>] [[-ExtendedForestInformation] <IDictionary>] [[-Forest] <String>] [[-IncludeDomains] <String[]>] [[-LimitProcessing] <Int32>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

This function removes duplicate GPOs based on the criteria provided. It retrieves duplicate GPO objects using Get-GPOZaurrDuplicateObject and then attempts to remove them from the Active Directory.

Examples

Authored help example

EXAMPLE 1

Remove-GPOZaurrDuplicateObject -Forest "contoso.com" -IncludeDomains "domain1.com", "domain2.com" -ExcludeDomains "domain3.com" -LimitProcessing 5

Description: Removes duplicate GPOs from the forest "contoso.com" for domains "domain1.com" and "domain2.com", excluding "domain3.com", processing only the first 5 duplicates.

Parameters

-ExcludeDomains String[] optionalposition: 2
Specifies an array of domains to exclude from the duplicate GPO removal process.
-ExtendedForestInformation IDictionary optionalposition: 4
Specifies additional information about the forest.
-Forest String optionalposition: 1aliases: ForestName
Specifies the forest where the duplicate GPOs are located.
-IncludeDomains String[] optionalposition: 3aliases: Domain, Domains
Specifies an array of domains to include in the duplicate GPO removal process.
-LimitProcessing Int32 optionalposition: 0
Specifies the maximum number of duplicate GPOs to process. Default is set to [int32]::MaxValue.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.