How to get password expiration date in Active Directory

Last updated on:

For an AD user account whose password is subject to expiration, the password expiration time is calculated using the user's pwdLastSet value and the applicable maximum password age (maxPwdAge). AD does not store the calculated expiration date as a persistent attribute. Instead, the domain controller calculates and exposes the expiration time through the constructed attribute msDS-UserPasswordExpiryTimeComputed when queried.

With ADManager Plus, administrators can not only find password expiration dates but also manage AD password policies to help ensure users comply with organizational password requirements.

This article covers the various ways in which you can retrieve the password expiration date including PowerShell, ADUC, and ADManager Plus.

  • PowerShell
  • ADUC
  • ADAC
  • Net user
  • ADManager Plus
  • FAQs
 

Method 1: PowerShell

How to get password expiration date in PowerShell

  1. Open PowerShell ISE as an administrator.
  2. Ensure the Active Directory module is installed. If it isn't, install the RSAT package for your Windows version and import the module.
  3. Import-Module ActiveDirectory
  4. Run the following command to retrieve the password expiration date for a specific user. Replace username with the user's login name.
  5. Get-ADUser -Identity "username" -Properties msDS-UserPasswordExpiryTimeComputed

Get the expiration date for a single user

Run the following command:

$user = Get-ADUser -Identity "jsmith" -Properties msDS-UserPasswordExpiryTimeComputed [datetime]::FromFileTime($user.'msDS-UserPasswordExpiryTimeComputed')

This retrieves the computed password expiration timestamp for jsmith and converts it into a human-readable date and time.

To display name, username, and expiration together:

Get-ADUser -Identity jsmith -Properties msDS-UserPasswordExpiryTimeComputed | Select-Object Name, SamAccountName, @{Name='PasswordExpires'; Expression={ $exp = $_.'msDS-UserPasswordExpiryTimeComputed' if ($exp -eq 9223372036854775807) { 'Never' } else { [datetime]::FromFileTime($exp) } }}

Outputs name, sAMAccountName, and expiration date. Accounts with password never expires return Never.

Get expiration dates for all domain users

Get-ADUser -Filter {Enabled -eq $true} -Properties msDS-UserPasswordExpiryTimeComputed | Select-Object Name, SamAccountName, UserPrincipalName, @{Name='PasswordExpires'; Expression={ $exp = $_.'msDS-UserPasswordExpiryTimeComputed' if ($exp -eq 9223372036854775807) { 'Never' } else { [datetime]::FromFileTime($exp) } }}

Returns all enabled accounts with display name, sAMAccountName, UPN, and computed expiration date.

Export results to CSV

Get-ADUser -Filter {Enabled -eq $true} -Properties msDS-UserPasswordExpiryTimeComputed | Select-Object Name, SamAccountName, UserPrincipalName, @{Name='PasswordExpires'; Expression={ $exp = $_.'msDS-UserPasswordExpiryTimeComputed' if ($exp -eq 9223372036854775807) { 'Never' } else { [datetime]::FromFileTime($exp) } }} | Export-Csv -Path 'C:\Reports\PasswordExpiration.csv' -NoTypeInformation

Writes a CSV to C:\Reports\PasswordExpiration.csv with one row per enabled user.

Method 2: Active Directory Users and Computers (ADUC)

How to get an AD user's password expiration date using ADUC

  1. Open Active Directory Users and Computers (dsa.msc).
  2. From the menu bar, select View > Advanced Features. This unlocks the Attribute Editor tab on object properties.
  3. Navigate to the user account, right-click it, and select Properties.
  4. Select the Attribute Editor tab.
  5. Click Filter and enable Show only attributes that have values and Constructed. Without the Constructed filter, msDS-UserPasswordExpiryTimeComputed does not appear in the list.
  6. Scroll to msDS-UserPasswordExpiryTimeComputed in the alphabetical list. The value shown is a raw Windows FILETIME integer.
  7. To convert the value to a readable date, run it through PowerShell: [datetime]::FromFileTime(<value>). ADUC itself does not perform this conversion.

Method 3: Active Directory Administrative Center (ADAC)

How to get an AD user's password expiration date using ADAC

  1. Open Active Directory Administrative Center (dsac.exe).
  2. Navigate to the domain and locate the user account.
  3. Right-click the user and select Properties.
  4. In the properties panel, scroll to the Extensions section and expand it.
  5. Select the Attribute Editor tab within Extensions.
  6. Click Filter and enable Constructed to make msDS-UserPasswordExpiryTimeComputed visible.
  7. Locate msDS-UserPasswordExpiryTimeComputed in the list. Convert the displayed FILETIME integer using [datetime]::FromFileTime(<value>) in PowerShell to get the readable date.

Method 4: The net user command

How to get an AD user's password expiration date using Net User Command

  1. Open Command Prompt.
  2. Run the following command, replacing jsmith with the username:
    net user jsmith /domain
  3. Review the output and locate the Password expires field to see the password expiration date.
  4. To display only the Password expires line, run:
    net user jsmith /domain | findstr /i "password expires"
  5. The command returns the password expiration date as a readable date string.

Limitations of using native tools to get password expiration date

Native AD tools can retrieve password expiration dates, but they have several limitations when it comes to day-to-day reporting and administration.

  1. Limited bulk reporting. ADUC, ADAC, and net user are mainly designed for checking individual accounts. They do not provide a convenient way to generate password expiration reports across multiple users.
  2. Manual date conversion. ADUC and ADAC display the msDS-UserPasswordExpiryTimeComputed value as a raw FILETIME integer, requiring additional PowerShell conversion to get a readable date.
  3. Limited export options. ADUC and ADAC do not provide direct export capabilities, while net user produces plain-text output that requires additional parsing for structured reporting.
  4. No built-in scheduling or alerting. Native tools do not provide built-in options to schedule recurring password expiration reports or automatically email them to recipients.
  5. Additional tools may be required. PowerShell reporting requires the Active Directory module, which may require RSAT on workstations.
  6. Script maintenance. PowerShell-based reports require scripting knowledge and ongoing maintenance when reporting requirements, domains, or OU structures change.
  7. Limited delegation. Native tools do not provide granular, built-in delegation for allowing help desk technicians to run password expiration reports for specific OUs without broader AD or PowerShell access.

Method 5: ADManager Plus

ADManager Plus fetches password expiration date through a prebuilt report that requires no scripting. The report reads msDS-UserPasswordExpiryTimeComputed from the domain controller and presents results in a filterable, sortable table exportable in multiple formats. You can schedule this and other reports in ADManager Plus to run periodically.

Generate the password expiration report

  1. Log in to ADManager Plus.
  2. Navigate to Reports > User Reports > All Users.
  3. Select the target domain from the Domain drop-down.
  4. Click Add/Remove Columns and add the Password Expiry Date column.
  5. Click Generate. The report loads all user accounts with their computed password expiration dates.
  6. Click Export and select CSV, PDF, XLSX, HTML, or CSVDE.

Schedule and email the report automatically

  1. Generate the report, then click Schedule Reports.
  2. Click Create Schedule and give the schedule a name.
  3. Select User Reports, followed by All Users Report.
  4. Set the frequency (daily, weekly, or monthly), delivery time, and output format.
  5. Enter one or more recipient email addresses.
  6. Click Save. ADManager Plus sends the report at each scheduled interval without further intervention.

How ADManager Plus simplifies password management

Managing user passwords and tracking password status across AD can be time-consuming with PowerShell scripts and other native methods. ADManager Plus provides prebuilt reports and password management capabilities that eliminate the need for scripting for common password-related tasks. Using ADManager Plus, you can:

Frequently asked questions

Run net user <username> /domain from Command Prompt, or use PowerShell's Get-ADUser <username> -Properties msDS-UserPasswordExpiryTimeComputed and convert the value with [datetime]::FromFileTime(). For local (non-domain) accounts, net user <username> without /domain shows the same information. Alternatively, you can also find the password expiration date of AD users using ADManager plus.

The built-in command is net user <username> /domain, which returns the Password expires field directly in Command Prompt without needing any scripting. To get the same information on bulk users, you can follow the steps mentioned here.

Use Get-ADUser <username> -Properties msDS-UserPasswordExpiryTimeComputed, it returns True or False directly. For complete step-by-step instructions, refer to the following webpage: How to get password expiration date

Windows doesn't natively send password expiry notifications to users. Traditionally, administrators have to create and schedule custom PowerShell scripts that query msDS-UserPasswordExpiryTimeComputed,identify accounts nearing password expiration, and send email alerts.

ADManager Plus simplifies this process with built-in password expiration notifications. Instead of maintaining custom scripts, administrators can configure automated email alerts, define notification schedules and thresholds, and notify users before their passwords expire. This helps reduce administrative effort and minimizes the risk of users being locked out due to expired passwords.

You can pipe the results of Get-ADUser to Export-Csv to create a CSV file containing each user's name, username, UPN, and password expiration date. This is useful for creating a report that can be shared or reviewed offline.

For example, to find users whose passwords expire within 14 days:

Set a date threshold using (Get-Date).AddDays(14) and filter the results based on the PasswordExpires value. This returns enabled users whose passwords are due to expire within the next 14 days while excluding accounts whose passwords are set to never expire.

Alternatively, ADManager Plus provides password expiration reports that help administrators identify users whose passwords are about to expire without having to run PowerShell queries manually.

Use the -SearchBase parameter with Get-ADUser to limit the query to a specific organizational unit. For example, -SearchBase 'OU=Sales,DC=contoso,DC=com' returns password expiration dates for enabled users in the Sales OU.

To know how to retrieve password expiration details for a single user or all users using PowerShell, see how to check Active Directory password expiration using PowerShell.

The password has expired but the account remains enabled. AD does not automatically disable accounts when passwords expire; it only blocks interactive logons requiring password authentication. Service accounts and Kerberos sessions not yet expired may still function after the expiration date.

Simplify Active Directory password management with ADManager Plus

The one-stop solution to Active Directory Management and Reporting
Email Download Link Email the ADManager Plus download link