Get Last Logon Time For All Users In An Ad

under Programming PowerShell

 

Utilizing the ActiveDirectory module, this returns user names with last logon time stamp

Import-Module ActiveDirectory
Get-ADUser -LDAPFilter "(ObjectClass=user)" | Get-ADObject -Properties lastLogon | `
      ForEach-Object { Write-Host ("{0}`t{1}" -f $_.Name,([DateTime]::FromFileTime($_.lastLogon)))}