Get Active Directory user account last logged on time (PowerShell)

This PowerShell Script shows how to use Windows PowerShell to determine the last time that a user logged on to the system.
4.3 Star
54,430 times
Add to favorites
Active Directory
E-mail Twitter Digg Facebook
  • Poll All DCs
    1 Posts | Last post October 02, 2015
    • Would be great if this script polled all the DCs and returned just the latest LastLogonTimeStamp value for an account. Anyone ?
  • script failure
    2 Posts | Last post July 14, 2015
    • great script!
      having issues however when i try to use a csv import. if i use a testcsv file it only works for the first user.
      if the CSV has more than that it does nothing
      any help appreciated!
    • With the same concern to check users last logon details, you can checkout Lepide last logon reporter tool( ) that is available free and provides accurate last logon time of all the users in the domain with just a few clicks.
  • More than one samaccountname in my CSV
    2 Posts | Last post October 28, 2014
    • I was struggling with the same issue.  If the CSV had more than one entry the script wouldn't run correctly and basically do nothing.  I found that I had to update .net to version 4.5 and then install the Windows Management Framework 4.0.  Just a note: You HAVE TO update .net to 4.5.  There a big in the Windows Management Framework 4.0 installer where without .net 4.5, the install says it installs succesfully but it doesn't. After that the script, using a CSV with thousands of entries worked perfect.
    • I've .net 4.5.1 & WMF4 installed and still dont get any data into the file.
  • More than one sam account name
    1 Posts | Last post July 30, 2014
    • Is any help here, I have same problem as below, any ideas? 
  • More than one sam account name
    1 Posts | Last post May 21, 2014
    • Hello,
      I have the same problem. More than one account name it doesn't list anything.
11 - 15 of 15 Items