Get Active Directory users expiration date

If you need to know when your users passwords will expire in AD, you can execute this commands in Powershell, this will response with all the accounts and dates.

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”)}}

Output example:

Displayname ExpiryDate
———– ———-
John Doe 15/10/2018 18:45:29
Jane Doe 20/10/2018 10:32:21

Anyway if you need expiration date for specific user you can execute this one in your command prompt

Net User username /domain

Output example:

C:\Users\administrador>Net User jdoe /domain
User name                                   jdoe
Full Name                                   John Doe
Comment
User’s comment
Country code (null)
Account active                               Yes
Account expires Never

Password last set                            30/11/2017 12:29:50
Password expires                             28/02/2018 12:29:50
Password changeable                          30/11/2017 12:29:50
Password required                            Yes
User may change password                     Yes

Workstations allowed                         All
Logon script                                 shared.cmd
User profile
Home directory
Last logon                                   28/02/2018 12:27:53

Logon hours allowed                          All

Local Group Memberships
Global Group memberships                     *Group Shared *Grup CPL
                                             *Group Security *Group Adm
                                             *Group App Help *Group Users TS
                                             *Contoso *Group IT
                                             *Domain User
The command completed successfully.

Hope you’ll find useful

Leave a Reply

Your email address will not be published.

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