Get a list of all computers in Active Directory with date lastlogon and OS

I needed to list all computers in use at customers, with os, and for the less diligently maintained AD’s also if they were still in use. You can obtain this by reading the value of lastlogondate of a machine account.

Get-ADcomputer -Filter * -Properties * | Sort LastLogonDate | FT Name, LastLogonDate, OperatingSystem
This entry was posted in Active Directory, powershell. Bookmark the permalink.