Hey I have below script to pull out the information of inactive users in domain.
But I want to understand that on which attribute, inactive users mark as inactive in AD.
I mean the attribute of lastlogontimestamp or lastlogondate?
Hence, I have most of the users in my domain which lastlogontimestamp or lastlogondate is not set their attributes then How can I get to know the these accounts are inactive in AD?
Import-Module ActivedirectorySearch-ADAccount -accountinactive -usersonly -DateTime (Get-Date).AddMonths(-14) | Where {$_.SamAccountName -like "d00*" -and $_.enabled}| select name,SamAccountName,lastlogondate,UserPrincipalName | Export-Csv C:\inactive.csv -NoTypeInformation