TestimoX

API Reference

Class

LingeringObjects

Namespace ADPlayground
Assembly ADPlayground

Provides utilities for detecting lingering objects across domain controllers.

Inheritance

  • Object
  • LingeringObjects

Constructors

public LingeringObjects(InternalLogger internalLogger = null, LingeringObjectDetector detector = null) #

LingeringObjects class constructor

Parameters

internalLogger ADPlayground.InternalLogger = null optionalposition: 0
Optional logger instance.
detector ADPlayground.LingeringObjectDetector = null optionalposition: 1
Optional lingering object detector.

Methods

AddDomainControllerToDomain(System.String domain, System.String domainController) #

Adds a domain controller to the list of domain controllers for a given domain.

Parameters

domain System.String required
The domain name.
domainController System.String required
The domain controller name.
CalculateProgress(System.Int32 currentSteps, System.Int32 totalSteps) #

Calculates the progress percentage clamped between 0 and 100.

Parameters

currentSteps System.Int32 required
Current steps completed.
totalSteps System.Int32 required
Total number of steps.

Returns

Progress percentage from 0 to 100.

public async Task DetectInfrastructureAsync(CancellationToken cancellationToken = null) #
Returns: Task

Detects the infrastructure including domain controllers, naming contexts and global catalogs

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
DetectInfrastructureTask(System.Threading.CancellationToken arg1) #

Detects lingering objects in environment and returns the list of them

Parameters

arg1 System.Threading.CancellationToken required

Returns

List of detected lingering objects

DetectLingeringObjectsAsync 4 overloads
public async Task<List<LingeringObject>> DetectLingeringObjectsAsync(String targetDC, String referenceDC, String namingContext, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Detects lingering objects in environment and returns the list of them It takes the target domain controller and reference domain controller as input including the naming context

Parameters

targetDC System.String requiredposition: 0
referenceDC System.String requiredposition: 1
namingContext System.String requiredposition: 2
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsAsync(String targetDC, String referenceDC, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Detects lingering objects in environment and returns the list of them It takes the target domain controller and reference domain controller and scans all naming contexts

Parameters

targetDC System.String requiredposition: 0
referenceDC System.String requiredposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsAsync(ADChoices reference, String referenceName, ADChoices target, String targetName, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Detects lingering objects using default naming context selection.

Parameters

reference ADPlayground.ADChoices requiredposition: 0
Reference location type.
referenceName System.String requiredposition: 1
Reference location name.
target ADPlayground.ADChoices requiredposition: 2
Target location type.
targetName System.String requiredposition: 3
Target location name.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Token used to cancel the operation.

Returns

List of lingering objects.

public async Task<List<LingeringObject>> DetectLingeringObjectsAsync(ADChoices reference, String referenceName, ADChoices target, String targetName, List<String> namingContext, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Detects lingering objects using a provided list of naming contexts.

Parameters

reference ADPlayground.ADChoices requiredposition: 0
Reference location type.
referenceName System.String requiredposition: 1
Reference location name.
target ADPlayground.ADChoices requiredposition: 2
Target location type.
targetName System.String requiredposition: 3
Target location name.
namingContext System.Collections.Generic.List{System.String} requiredposition: 4
Naming contexts to scan.
cancellationToken System.Threading.CancellationToken = null optionalposition: 5
Token used to cancel the operation.

Returns

List of lingering objects.

DetectLingeringObjectsByDomainAsync 3 overloads
public async Task<List<LingeringObject>> DetectLingeringObjectsByDomainAsync(String targetDomainName, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Detects lingering objects in environment and returns the list of them It takes the target domain name, finds all the domain controllers in the domain and then assumes reference domain controllers (one from each domain) and scans all naming contexts

Parameters

targetDomainName System.String requiredposition: 0
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsByDomainAsync(String targetDomainName, List<String> namingContext, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Detects lingering objects in environment and returns the list of them It takes the target domain name, finds all the domain controllers in the domain and then assumes reference domain controllers (one from each domain) and scans given naming context

Parameters

targetDomainName System.String requiredposition: 0
namingContext System.String requiredposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Token used to cancel the operation.
DetectLingeringObjectsByDomainAsync(System.String targetDomainName, System.Collections.Generic.List{System.String} namingContext, System.Threading.CancellationToken cancellationToken) #

Detects lingering objects in environment and returns the list of them It takes the target domain name, finds all the domain controllers in the domain and then assumes reference domain controllers (one from each domain) and scans given naming contexts

Parameters

targetDomainName System.String required
namingContext System.Collections.Generic.List{System.String} required
cancellationToken System.Threading.CancellationToken required
Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsByDomainControllerAsync(String targetDomainController, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Search for lingering objects in the entire forest for specific domain controller

Parameters

targetDomainController System.String requiredposition: 0
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsForDomainsAsync(IEnumerable<String> domainNames = null, IEnumerable<String> namingContexts = null, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObject>>

Detects lingering objects for one or more domains in the current forest.

Parameters

domainNames System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 0
Optional list of domain names. When omitted, all forest domains are scanned.
namingContexts System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
Optional naming contexts. When omitted, all naming contexts are scanned.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Token used to cancel the operation.

Returns

Distinct lingering objects found across all scanned domains.

public List<String> GetDomainControllersForDomain(String domain) #
Returns: List<String>

Gets the list of domain controllers for a given domain.

Parameters

domain System.String requiredposition: 0
The domain name.

Returns

The list of domain controllers.

public List<LingeringObjectInfo> GetLingeringObjectInfos() #
Returns: List<LingeringObjectInfo>

Gets information about detected lingering objects.

Returns

List of LingeringObjectInfo.

RemoveLingeringObjectsAsync 2 overloads
public async Task RemoveLingeringObjectsAsync(List<LingeringObject> lingeringObjectList, LingeringObjectRemovalMethod method, CancellationToken cancellationToken = null) #
Returns: Task

Removes lingering objects from given list

Parameters

lingeringObjectList System.Collections.Generic.List{ADPlayground.LingeringObject} requiredposition: 0
List of objects to remove.
dsReplicaVerifyObjects System.Boolean requiredposition: 1
Whether to verify objects using DSReplicaVerify.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Token used to cancel the operation.
RemoveLingeringObjectsAsync(System.Collections.Generic.List{ADPlayground.LingeringObject} lingeringObjectList, ADPlayground.LingeringObjectRemovalMethod method, System.Threading.CancellationToken cancellationToken) #

Removes lingering objects using the selected backend method.

Parameters

lingeringObjectList System.Collections.Generic.List{ADPlayground.LingeringObject} required
List of objects to remove.
method ADPlayground.LingeringObjectRemovalMethod required
Removal method backend.
cancellationToken System.Threading.CancellationToken required
Token used to cancel the operation.
public async Task<List<LingeringObjectRemovalResult>> RemoveLingeringObjectsWithResultsAsync(List<LingeringObject> lingeringObjectList, LingeringObjectRemovalMethod method, CancellationToken cancellationToken = null) #
Returns: Task<List<LingeringObjectRemovalResult>>

Removes lingering objects using the selected backend method and returns structured results.

Parameters

lingeringObjectList System.Collections.Generic.List{ADPlayground.LingeringObject} requiredposition: 0
List of objects to remove.
method ADPlayground.LingeringObjectRemovalMethod requiredposition: 1
Removal method backend.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Token used to cancel the operation.

Returns

Removal results describing the executed scope and outcome.

WaitForDcEntryAsync(System.String dcName, System.Threading.CancellationToken ct) #

Waits for a domain controller entry to be released from the dictionary.

Parameters

dcName System.String required
Domain controller name.
ct System.Threading.CancellationToken required
Cancellation token.

Returns

true if the entry became available before timeout; otherwise false.

Properties

public Boolean Error { get; set; } #

Show or hide error messages in console.

public Boolean Verbose { get; set; } #

Show or hide verbose messages in console.

public Boolean Warning { get; set; } #

Show or hide warning messages in console.

public Boolean Progress { get; set; } #

Show or hide progress messages in console.

public Boolean Debug { get; set; } #

Show or hide debug messages in console.

Fields

_LockObject #

Variable to lock access during multi-threaded operations

_logger #

Default logger

LingeringObjectsList #

List of lingering objects detected during scanning

public Boolean ADTopologyWasSuccessfullyDiscovered #

Provides information whether the AD topology was successfully discovered

public HashSet<String> AllDomainControllersInTheForest #

All domain controllers in the forest

public List<String> AllNamingContextsInTheForest #

Naming contexts in the forest

public ConcurrentDictionary<String, Int32> DetectionCompletedEventsDictionary #

Detection completed events dictionary

public Int32 DetectionTimeoutPerDCSeconds #

Timeout in seconds for each domain controller to complete lingering object detection. Defaults to 300 seconds.

public Dictionary<String, HashSet<String>> DomainToDomainControllersMap #

Map of domains to domain controllers

public Boolean IgnoreDeleted #

Set to true to ignore deleted objects when scanning for lingering objects. This can be helpful in domains with a large number of deleted objects that will eventually be garbage collected. Defaults to false to include deleted objects in the scan.

public ConcurrentDictionary<String, Guid> KnownReferenceDCGuids #

Dictionary of known reference DC GUIDs

public List<String> KnownWritableGlobalCatalogs #

Known writable global catalogs

public Int32 MaxWaitForDcEntryRetries #

Maximum number of retries while waiting for a domain controller entry. Defaults to 20 retries. Set to 0 to disable attempt-based limits.

public Int32 NumberOfLingeringObjectsFound #

Number of lingering objects found during scanning

public Int32 NumberOfThreads #

Number of threads to use for lingering object detection. Defaults to 8.

public Double WaitTimeForDCSeconds #

Number of seconds to wait for a domain controller to become available in the dictionary. Defaults to 7200 seconds (two hours). Set to 0 to disable elapsed-time limits.