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.
Happy Learning..,
Sitaram Pamarthi
$user = "user1"It will be more easy if you have Quest PowerShell Cmdlets for active roles installed in your PC. Download it from Quest site and install on your machine and execute the below oneliner in Quest powershell window.
$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
Get-QADUser user1 | ft displayname, PasswordLastSet
Happy Learning..,
Sitaram Pamarthi
No comments:
Post a Comment