Powershell one-liner to find all users in an OU not logged in for a time span

2017-12-08T14:27:03+00:00 March 30th, 2016|PowerShell|0 Comments

Here’s a handy one liner to find all users in a particular OU not logged in for 90 days:


search-adaccount -accountinactive -usersonly -TimeSpan 90.00:00:00 -SearchBase “OU=Users,OU=Company,DC=Contoso,DC=com” | export-csv usersnotloggedinfor90days.csv


Hope it helps!

Leave A Comment

like what you see? 

Sign-up to our newsletter and never miss out on the latest blogs, events and tech news from the world of risual
Give it a try, you can unsubscribe anytime.