API Reference
Class
GpoCleaner
Removes GPOs by state with optional backup and simple content checks.
Inheritance
- Object
- GpoCleaner
Methods
public static Boolean IsLikelyEmpty(String sysvolPath) #Returns:
BooleanChecks whether a GPO SYSVOL folder lacks common content (registry.pol, security template, scripts).
Parameters
- sysvolPath System.String
- Path to SYSVOL\Policies\{GUID}.
Returns
True when likely empty; false on errors or when content is found.
public static Boolean IsSettingsEmpty(String sysvolPath) #Returns:
BooleanChecks whether a GPO has zero registry or security template settings (ignores scripts).
Parameters
- sysvolPath System.String
- Path to SYSVOL\Policies\{GUID}.
Returns
True when there are no registry or security template settings.
public static Boolean IsTrulyEmpty(String sysvolPath) #Returns:
BooleanChecks whether a SYSVOL GPO folder has no files except GPT.INI.
Parameters
- sysvolPath System.String
- Path to SYSVOL\Policies\{GUID}.
Returns
True when folder contains no files (GPT.INI excluded).
public static Boolean TryDelete(String domainName, Guid gpoId, String sysvolPath) #Returns:
BooleanDeletes a GPO by removing the AD container and its SYSVOL folder (best-effort).
Parameters
- domainName System.String
- DNS domain name.
- gpoId System.Guid
- GPO identifier.
- sysvolPath System.String
- Path to the GPO's SYSVOL folder.
Returns
True when the delete completed (SYSVOL removal errors are non-fatal).