Here is a quick snippet of code that can assist you in determining if anyone’s account passwords were changed recently. As you can imagine, with a bit of tweaking you can use this to determine those that have not changed their passwords in the same timeframe.

To change the amount of days you are searching, change the number in line 2 after AddDays(-#)

For best results, we recommend running this commands on a Domain Controller or a system with AD RSAT tools installed.

Import-Module ActiveDirectory
$DateCutOff=(Get-Date).AddDays(-5)
Get-ADUser -Filter * -Property passwordlastset | Where {$_.passwordlastset -gt $datecutoff} | FT Name, passwordlastset -Autosize

Leave a Comment

Your email address will not be published. Required fields are marked *