Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

listing AD accounts that been inactive for more than 90 days, or that shows the last used date

$
0
0

Hi, I am trying to get information about more than 90 days, could someone verify script below, is it fine or I should add anything else

$90Days = (get-date).adddays(-90)

Get-ADUser -properties * -filter {(lastlogondate -notlike "*" -OR lastlogondate -le $90days) -AND (passwordlastset -le $90days) -AND (enabled -eq $True) -and (PasswordNeverExpires -eq $false) -and (whencreated -le $90days)} | select-object name, SAMaccountname, passwordExpired, PasswordNeverExpires, logoncount, whenCreated, lastlogondate, PasswordLastSet, lastlogontimestamp


AG


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>