API Reference
Class
InactiveUserDetector (Users)
Detects accounts that have not logged on since a configurable grace period.
Inheritance
- Object
- InactiveUserDetector
Methods
public static IEnumerable<AccountLogonInfo> FilterInactiveAccounts(IEnumerable<AccountLogonInfo> accounts, Int32 gracePeriodDays) #Returns:
IEnumerable<AccountLogonInfo>Filters accounts that have not logged on since gracePeriodDays.
Parameters
- accounts System.Collections.Generic.IEnumerable{ADPlayground.AccountLogonInfo}
- Accounts to evaluate.
- gracePeriodDays System.Int32
- Number of days of allowed inactivity.
Returns
Collection of inactive accounts.
public static IEnumerable<AccountLogonInfo> GetInactiveAccounts(String domainName, Int32 gracePeriodDays, String forestName = null) #Returns:
IEnumerable<AccountLogonInfo>Queries Active Directory and returns accounts inactive since the specified grace period. Uses multi-domain LDAP queries with automatic domain iteration and error handling.
Parameters
- domainName System.String
- Domain to query. When null or empty all domains in the current or specified forest are scanned.
- gracePeriodDays System.Int32
- Number of days of allowed inactivity.
- forestName System.String = null
- Optional forest to target when domainName is not specified.
Returns
Collection of inactive accounts.
MapToAccountLogonInfo(System.DirectoryServices.SearchResult result, System.DateTime threshold) #Maps LDAP search result to AccountLogonInfo with inactive account filtering. Returns null for accounts that do not meet inactive criteria for performance optimization.
Parameters
- result System.DirectoryServices.SearchResult
- LDAP search result
- threshold System.DateTime
- Date threshold for determining inactivity
Returns
AccountLogonInfo for inactive accounts, null for active accounts