# Remove-GPOZaurrLegacyFiles

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

Project

GPOZaurr

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

[View on GitHub](https://github.com/EvotecIT/GPOZaurr) [Visit Website](#) [Releases](https://github.com/EvotecIT/GPOZaurr/releases/tag/v1.1.10) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/GPOZaurr/1.1.9)

Stars **1,257**

Forks **121**

Open issues **15**

PowerShell Gallery downloads **421,558**

Release **v1.1.11**

Language: PowerShell Updated: 2026-10-30

Command 

**Module**

`GPOZaurr`

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

## Syntax

```
Remove-GPOZaurrLegacyFiles
[-BackupDated]
[[-BackupPath] <String>]
[[-ExcludeDomains] <String[]>]
[[-Forest] <String>]
[[-IncludeDomains] <String[]>]
[[-LimitProcessing] <Int32>]
[-RemoveEmptyFolders]
[<CommonParameters>]
```

[#](#method-remove-gpozaurrlegacyfiles-switchparameter-string-string-string-string-int32-switchparameter)

Parameter set: `All Parameter Sets`

## Description

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

### Example 1

```powershell
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.
```

## Parameters

**-BackupDated SwitchParameter optional**

Indicates whether backup files should be timestamped with the current date and time.

**-BackupPath String optionalposition: 0**

Specifies the path where backup files will be stored.

**-ExcludeDomains String[] optionalposition: 2**

Specifies an array of domains to exclude from processing.

**-Forest String optionalposition: 1aliases: ForestName**

Specifies the forest where the GPO files are located.

**-IncludeDomains String[] optionalposition: 3aliases: Domain, Domains**

Specifies an array of domains to include for processing.

**-LimitProcessing Int32 optionalposition: 4**

Specifies the maximum number of GPO files to process.

**-RemoveEmptyFolders SwitchParameter optional**

Indicates whether empty folders should be removed after GPO files are deleted.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:4005E6AE3E4A9EDB3B0A51165070ACD7373931F7004DCBA9A293337B2DC6175F -->
