PowerShell – List users based on Last Logon Time
October 2nd, 2008
I needed an easy way of working out how many active users are on the network in a 60 day period.
I realise I could have done this with DSQUERY/DSGET but I figured it’s high time to learn powershell.. So, this is my first real foray into Windows PowerShell.
To make my life easier I Installed PowerGUI and enabled the Active Directory QAD cmdlets.
The script below searches for all accounts that were logged in within the last 60 days, it only searches in the users OU as specified by the $searchRoot variable.