How to generate reports on last logon time AD computers using PowerShell scripts?
Read on to know how to view last logon time reports for computer accounts with PowerShell scripts in Active Directory (AD) and how you can get it done easily with ADManager Plus.
- Identify the domain for which the last logon report is to be obtained.
- Create and compile the script for obtaining last logon report. Execute the script in PowerShell.
- Sample script for obtaining the last logon time for AD computer:
Click to copy entire script
Get-ADComputer -identity testuser001 -Properties * | FT Name, LastLogonDate
- Navigate to Reports > Computer Reports >All Computers .
- Select the Domain and the Computer for which you wish to view the last logon time for. Then click Generate.
- You can even export the reports as CSV, PDF, XLSX or HTML.
» Start 30-day Free Trial
Although generating NTFS reports with native tools like PowerShell looks simple, it comes with a few limitations:
- PowerShell script can be run only from the computers which have the Active Directory Domain Services role installed in them.
- The script has to be rewritten if report has to be generated for a different computer.
- Need for a new script, in case the report needs to be exported.
- The syntax, parameters and iterations need to be correct. A typo or incorrect syntax might be difficult to spot and rectify, especially when the script is a long one.
ADManager Plus lets you perform the same with a few clicks from its web based GUI console. It also has options for scheduling and automatically emailing the reports. Learn more about it here.