• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

List of users' password validity in AD

could anybody provide with any script (PowerShell) that I could run and get passwords validity off all my users in AD.

  • 3
1 Solution
Meir RivkinFull stack Software EngineerCommented:

   import-module ActiveDirectory
   $reportObject = @()
$userList = Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq  $False} -Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |  Where-Object {$_.DisplayName -ne $null}
$userList | %{

    $output = "" | Select DisplayName, ExpiryDate
    $output.DisplayName = $_.DisplayName
    $output.ExpiryDate = ([datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")).DateTime
    $reportObject += $output
    #Next 2 Lines provide debugging... I'm not sure the date time portion will work without having AD to play with
#    $output | fl *
#    ([datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")).DateTime 

$reportObject | Convertto-CSV -NoTypeInformation

Open in new window

From: powershell-get-password-expiration-for-all-non-disabled-users-in-ad
Pramod UbheCommented:
So you need to check if user's password expired or not right?
I can give it to you tomorrow if you don't get it till that time.
ikealtAuthor Commented:
actually I need like a table with user name and date then password was changed / created and then will expire. Through GPO I set password validity for 110 days.
ikealtAuthor Commented:
one thing sedgwick, this script has to be run on a server, or can I run from any computer in AD with admin rights?
ikealtAuthor Commented:
ok, thanks it works.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now