Script Download:
The script is available for download from https://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-user-246f17c7.
The sample code demonstrates how to use Windows PowerShell to determine the last time that a user logged on to the system.
You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery