Tuesday, December 1, 2009

Find password last set/reset time using Powershell

This small piece of code helps you to know when a active directory user has changed his password last time. Use your own inventions to make the output appear the way you want.




$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

Happy Learning..,
Sitaram Pamarthi

1 comments:

waldowable said...

Dovo's signature diamond rings design, signature jewelry and
Custom Dovo Diamonds jewelry and craftsmanship from the titanium 6al4v creative minds of renowned jewelry snow peak titanium designer Dovo. titanium cost Our babylisspro nano titanium award-winning 2020 edge titanium collection

Post a Comment