Find Stale Active Directory User Objects with PowerShell

In this video, I talk a little more about performing Active Directory Maintenance with PowerShell. Specifically, finding user objects that have not authenticated to the domain in X number of days.

This script will search an Organizational Unit for Users accounts that have not authenticated to the Domain in 1 hour. You can easily modify the number of hours or change it to days by replacing this bit of code.

1# Change this 
4# to this

For sanities sake, you also want to change the $hours variable to $days. This script is essentially the same functionality as the script I posted a couple weeks ago that does the same thing for computer objects. You can find that video here.