TestimoX

API Reference

Class

GpoCleaner

Namespace ADPlayground.Gpo
Assembly ADPlayground
Modifiers static

Removes GPOs by state with optional backup and simple content checks.

Inheritance

  • Object
  • GpoCleaner

Methods

public static Boolean IsLikelyEmpty(String sysvolPath) #
Returns: Boolean

Checks whether a GPO SYSVOL folder lacks common content (registry.pol, security template, scripts).

Parameters

sysvolPath System.String requiredposition: 0
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: Boolean

Checks whether a GPO has zero registry or security template settings (ignores scripts).

Parameters

sysvolPath System.String requiredposition: 0
Path to SYSVOL\Policies\{GUID}.

Returns

True when there are no registry or security template settings.

public static Boolean IsTrulyEmpty(String sysvolPath) #
Returns: Boolean

Checks whether a SYSVOL GPO folder has no files except GPT.INI.

Parameters

sysvolPath System.String requiredposition: 0
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: Boolean

Deletes a GPO by removing the AD container and its SYSVOL folder (best-effort).

Parameters

domainName System.String requiredposition: 0
DNS domain name.
gpoId System.Guid requiredposition: 1
GPO identifier.
sysvolPath System.String requiredposition: 2
Path to the GPO's SYSVOL folder.

Returns

True when the delete completed (SYSVOL removal errors are non-fatal).