Skip to content

Instantly share code, notes, and snippets.

@arieljannai
Created January 31, 2016 10:35
Show Gist options
  • Save arieljannai/b585093bd51df3aa90d8 to your computer and use it in GitHub Desktop.
Save arieljannai/b585093bd51df3aa90d8 to your computer and use it in GitHub Desktop.
Get all the users that their password has been expired (expiry date is set to the epoch date 1/1/1601 2:00:00 AM)
Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties "SamAccountName", "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName", "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | Where-Object {$_.ExpiryDate -like '*1601*'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment