Categories
Microsoft

Powershell : Query for user’s last logon date

I needed to work out some AD accounts’ last logon dates to make a further assessment, in powershell I found this was fairly simple:

To get a list of all user attributes available for query:

$> get-aduser -identity <USERNAME_HERE> -Properties *

To query for last logon date:

$> get-aduser -identity <USERNAME_HERE> -Properties LastLogonDate

 

Categories
Microsoft

Active Directory Powershell Last Login Date

PS C:\> get-adcomputer -Filter 'Name -like "$COMPNAME_HERE*"' -Properties lastlogondate | select name,lastlogondate