How to find recently joined computers in ActiveDirectory through a PowerShell command?

How can I find recently joined computers in ActiveDirectory with a PowerShell command?


All computer objects in AD have a whenCreated attribute you can filter against just like any other attribute.

Here's an example:

$lastWeek = (Get-Date).AddDays(-7)
Get-ADComputer -Filter { whenCreated -ge $lastWeek }

Keep in mind that this will only find newly created computer objects. If you have orphaned objects that get overwritten by new computers with the same name, the attribute will not be updated.