Active Directory password expiry date

Active Directory password expiry date

I ran into a need to check the password expiry date of users in an Active Directory environment and export the results to a CSV file for further processing.

This little PowerShell script performed the task nicely:

Get-ADUser -Server "domain.name" -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | 
Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | 
export-csv C:\Temp\Users.csv

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.