Evotec

Project

GPOZaurr

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

Stars 1,166
Forks 115
Open issues 16
PowerShell Gallery downloads 417,764
Release v1.1.9
Language: PowerShell Updated: 2026-04-11

API Reference

Function

Remove-GPOZaurrLegacyFiles

Namespace GPOZaurr

Removes legacy Group Policy Objects (GPO) files from specified domains.

Remarks

The Remove-GPOZaurrLegacyFiles function removes legacy GPO files from specified domains. It can back up the files before removal and optionally remove empty folders.

Examples

Authored help example

EXAMPLE 1

PS >


Remove-GPOZaurrLegacyFiles -BackupPath "C:\GPOBackups" -BackupDated -RemoveEmptyFolders -Forest "Contoso" -IncludeDomains "Domain1", "Domain2" -ExcludeDomains "Domain3" -LimitProcessing 100
Removes legacy GPO files from the "Contoso" forest for "Domain1" and "Domain2", excluding "Domain3". Backs up files to "C:\GPOBackups" with timestamps and removes empty folders after deletion.
        

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.

Syntax

Remove-GPOZaurrLegacyFiles [-BackupDated] [-BackupPath <String>] [-ExcludeDomains <String[]>] [-Forest <String>] [-IncludeDomains <String[]>] [-LimitProcessing <Int32>] [-RemoveEmptyFolders] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

BackupDated SwitchParameter optionalposition: namedpipeline: False
Indicates whether backup files should be timestamped with the current date and time.
BackupPath String optionalposition: 0pipeline: False
Specifies the path where backup files will be stored.
ExcludeDomains String[] optionalposition: 2pipeline: False
Specifies an array of domains to exclude from processing.
Forest String optionalposition: 1pipeline: Falsealiases: ForestName
Specifies the forest where the GPO files are located.
IncludeDomains String[] optionalposition: 3pipeline: Falsealiases: Domain, Domains
Specifies an array of domains to include for processing.
LimitProcessing Int32 optionalposition: 4pipeline: False
Specifies the maximum number of GPO files to process.
RemoveEmptyFolders SwitchParameter optionalposition: namedpipeline: False
Indicates whether empty folders should be removed after GPO files are deleted.