Powershell – Find AD Active Users Password Expirations

Find Active Users with PW Expires Date/Time:

Import-Module ActiveDirectory
Get-ADUser -SearchBase "DC=cordero,DC=me" -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties "SamAccountName","msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName", @{Name="Password Expiry Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | Format-Table

Find Active Users were PW Never Expires:

Import-Module ActiveDirectory
Get-ADUser -SearchBase "DC=cordero,DC=me" -filter {Enabled -eq $True -and PasswordNeverExpires -eq $True} -Properties "SamAccountName","msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName", @{Name="Password Expiry Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | Format-Table
More Stories
Dual Redistribution between BGP and EIGRP TAGs Prevent Loop