Phone Get Quote
US: +1 888 720 9500
US: +1 888 791 1189
Intl: +1 925 924 9500
Aus: +1 800 631 268
UK: 0800 028 6590
CN: +86 400 660 8680

Direct Inward Dialing: +1 408 916 9892

How to generate and export a computer user last logged into report

A system administrator would want to ensure that only authenticated users are logging into the organization's network. The following is a comparison between the methods of obtaining the AD computer a user last logged into details using Windows PowerShell and ADAudit Plus:

Windows PowerShell

Steps to obtain a user's last logon report using PowerShell:

  • Identify the domain from which you want to retrieve the report.
  • Identify the LDAP attributes you need to fetch the report.
  • Identify the primary DC to retrieve the report.
  • Compile the script.
  • Execute it in Windows PowerShell.
  • The report will be exported in the format specified in the script.
  • To obtain the report in a different format, modify the script accordingly.

Sample Windows PowerShell script

$Computers =  Get-ADComputer  -Filter {(enabled -eq "true") -and (OperatingSystem -Like "*XP*")} | Select-Object -ExpandProperty Name
ForEach($PSItem in $Computers) {
    $User = Get-CimInstance Win32_ComputerSystem -ComputerName $PSItem | Select-Object -ExpandProperty UserName
    $Obj = New-Object -TypeName PSObject -Property @{
        "Computer" = $PSItem
        "User" = $User

Click to copy entire script

ADAudit Plus

To obtain the report,

  • Login to ADAudit Plus web console as an administrator.
  • Navigate to the Reports tab and from the User Logon section in the left pane, select User's last logon report.
  • Select the domain and click Generate.
  • Select Export As to export the report in any of the preferred formats (CSV, PDF, HTML, CSVDE and XLSX).



Following are the limitations to obtain an AD user's last logon into any computer report using native tools like Windows PowerShell:

  • The script can be executed only from the computers which have Active Directory Domain Services role.
  • It's difficult to change date formats, and apply different time zones on the date results.
  • It is difficult to export the report in file formats other than CSV.
  • Applying more filters like OU or 'User name starts with' will increase the LDAP query complexity.

ADAudit Plus, on the other hand, will seamlessly generate a report to show a user's last logon on any computer in a simple and intuitively designed UI, at the click of a button.

  • Avoid complex PowerShell-scripting, and simplify AD change auditing with ADAudit Plus.
  • By clicking 'Get Your Free Trial', you agree to processing of personal data according to the Privacy Policy.
  • Thanks!
  • Your download is in progress and it will be completed in just a few seconds! If you face any issues, download manually here.

Related Resources

ADAudit Plus Trusted By