MKozlov
10/14/2019 - 9:06 AM

Last time user changed password

$user = "User1"
 $searcher=New-Object DirectoryServices.DirectorySearcher
 $searcher.Filter="(&(samaccountname=$user))"
 $results=$searcher.findone()
 $changedtime  = [datetime]::fromfiletime($results.properties.pwdlastset[0])
 write-host -b blue -f red The user, $user has changed password last time at $changedtime