Handy Active Directory Powershell Scripts

Find User password expiry date

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties “DisplayName”, “msDS-UserPasswordExpiryTimeComputed” | Select-Object -Property “Displayname”,@{Name=“ExpiryDate”;Expression={[datetime]::FromFileTime($_.“msDS-UserPasswordExpiryTimeComputed”)}}

Find Locked accounts

Search-ADAccount –LockedOut

Find Users with Password Never Expires

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $True} | FT Name

Find password set date for enabled users

Get-aduser -filter {Enabled -eq $true} -properties passwordlastset, passwordneverexpires | sort name | ft Name, passwordlastset, Passwordneverexpires

2 thoughts on “Handy Active Directory Powershell Scripts

Comments are closed.

Any comments or questions? Get in touch here or Email me at [email protected]