Get password expiration date from variable

Welcome Forums General PowerShell Q&A Get password expiration date from variable

Viewing 2 reply threads
  • Author
    • #256856
      Topics: 6
      Replies: 3
      Points: 85
      Rank: Member


      I know how to find the expiration date of a aduser’s password.

      That is…when we want this to know from all of the Ad users.

      I am struggling to het it from Just a few users .

      These users are in a Variabele like $users.samaccountname for instance.

      I need to use $users to get the date there password expires , select their name and e-mail adress.

      If you know the good way ….

      Appreciate IT…

    • #256883
      Topics: 1
      Replies: 85
      Points: 387
      Helping Hand
      Rank: Contributor

      I don’t know how $users was generated, but if it stores the output of Get-ADUser, there is a chance it does not have all of the properties required. That will require doing another Get-ADUser with the appropriate properties.

      Starting a query from scratch, you could do something like the following:

      If you must start from an already populated $users and it does not contain password properties, you must query them again:

      Of course, you can combine the two approaches. Performing a query for each user is going to take a long time if the user list is long. It may be more efficient to just query the domain again.

    • #256886
      Topics: 16
      Replies: 1842
      Points: 3,514
      Helping Hand
      Rank: Community Hero

      Reference the samaccountname as the identity:

Viewing 2 reply threads
  • You must be logged in to reply to this topic.