API Reference
LingeringObjects
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
- Optional logger instance.
- detector ADPlayground.LingeringObjectDetector = null
- 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
- The domain name.
- domainController System.String
- The domain controller name.
CalculateProgress(System.Int32 currentSteps, System.Int32 totalSteps) #Calculates the progress percentage clamped between 0 and 100.
Parameters
- currentSteps System.Int32
- Current steps completed.
- totalSteps System.Int32
- Total number of steps.
Returns
Progress percentage from 0 to 100.
public async Task DetectInfrastructureAsync(CancellationToken cancellationToken = null) #TaskDetects the infrastructure including domain controllers, naming contexts and global catalogs
Parameters
- cancellationToken System.Threading.CancellationToken = null
DetectInfrastructureTask(System.Threading.CancellationToken arg1) #Detects lingering objects in environment and returns the list of them
Parameters
- arg1 System.Threading.CancellationToken
Returns
List of detected lingering objects
public async Task<List<LingeringObject>> DetectLingeringObjectsAsync(String targetDC, String referenceDC, String namingContext, CancellationToken cancellationToken = null) #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
- referenceDC System.String
- namingContext System.String
- cancellationToken System.Threading.CancellationToken = null
- Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsAsync(String targetDC, String referenceDC, CancellationToken cancellationToken = null) #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
- referenceDC System.String
- cancellationToken System.Threading.CancellationToken = null
- Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsAsync(ADChoices reference, String referenceName, ADChoices target, String targetName, CancellationToken cancellationToken = null) #Task<List<LingeringObject>>Detects lingering objects using default naming context selection.
Parameters
- reference ADPlayground.ADChoices
- Reference location type.
- referenceName System.String
- Reference location name.
- target ADPlayground.ADChoices
- Target location type.
- targetName System.String
- Target location name.
- cancellationToken System.Threading.CancellationToken = null
- 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) #Task<List<LingeringObject>>Detects lingering objects using a provided list of naming contexts.
Parameters
- reference ADPlayground.ADChoices
- Reference location type.
- referenceName System.String
- Reference location name.
- target ADPlayground.ADChoices
- Target location type.
- targetName System.String
- Target location name.
- namingContext System.Collections.Generic.List{System.String}
- Naming contexts to scan.
- cancellationToken System.Threading.CancellationToken = null
- Token used to cancel the operation.
Returns
List of lingering objects.
public async Task<List<LingeringObject>> DetectLingeringObjectsByDomainAsync(String targetDomainName, CancellationToken cancellationToken = null) #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
- cancellationToken System.Threading.CancellationToken = null
- Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsByDomainAsync(String targetDomainName, List<String> namingContext, CancellationToken cancellationToken = null) #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
- namingContext System.String
- cancellationToken System.Threading.CancellationToken = null
- 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
- namingContext System.Collections.Generic.List{System.String}
- cancellationToken System.Threading.CancellationToken
- Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsByDomainControllerAsync(String targetDomainController, CancellationToken cancellationToken = null) #Task<List<LingeringObject>>Search for lingering objects in the entire forest for specific domain controller
Parameters
- targetDomainController System.String
- cancellationToken System.Threading.CancellationToken = null
- Token used to cancel the operation.
public async Task<List<LingeringObject>> DetectLingeringObjectsForDomainsAsync(IEnumerable<String> domainNames = null, IEnumerable<String> namingContexts = null, CancellationToken cancellationToken = null) #Task<List<LingeringObject>>Detects lingering objects for one or more domains in the current forest.
Parameters
- domainNames System.Collections.Generic.IEnumerable{System.String} = null
- Optional list of domain names. When omitted, all forest domains are scanned.
- namingContexts System.Collections.Generic.IEnumerable{System.String} = null
- Optional naming contexts. When omitted, all naming contexts are scanned.
- cancellationToken System.Threading.CancellationToken = null
- Token used to cancel the operation.
Returns
Distinct lingering objects found across all scanned domains.
public List<String> GetDomainControllersForDomain(String domain) #List<String>Gets the list of domain controllers for a given domain.
Parameters
- domain System.String
- The domain name.
Returns
The list of domain controllers.
public List<LingeringObjectInfo> GetLingeringObjectInfos() #List<LingeringObjectInfo>Gets information about detected lingering objects.
Returns
List of LingeringObjectInfo.
public async Task RemoveLingeringObjectsAsync(List<LingeringObject> lingeringObjectList, LingeringObjectRemovalMethod method, CancellationToken cancellationToken = null) #TaskRemoves lingering objects from given list
Parameters
- lingeringObjectList System.Collections.Generic.List{ADPlayground.LingeringObject}
- List of objects to remove.
- dsReplicaVerifyObjects System.Boolean
- Whether to verify objects using DSReplicaVerify.
- cancellationToken System.Threading.CancellationToken = null
- 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}
- List of objects to remove.
- method ADPlayground.LingeringObjectRemovalMethod
- Removal method backend.
- cancellationToken System.Threading.CancellationToken
- Token used to cancel the operation.
public async Task<List<LingeringObjectRemovalResult>> RemoveLingeringObjectsWithResultsAsync(List<LingeringObject> lingeringObjectList, LingeringObjectRemovalMethod method, CancellationToken cancellationToken = null) #Task<List<LingeringObjectRemovalResult>>Removes lingering objects using the selected backend method and returns structured results.
Parameters
- lingeringObjectList System.Collections.Generic.List{ADPlayground.LingeringObject}
- List of objects to remove.
- method ADPlayground.LingeringObjectRemovalMethod
- Removal method backend.
- cancellationToken System.Threading.CancellationToken = null
- 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
- Domain controller name.
- ct System.Threading.CancellationToken
- Cancellation token.
Returns
true if the entry became available before timeout; otherwise false.
Inherited Methods
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.