locked
Disable password never expire and password reset RRS feed

  • Question

  • Hi,

    I want to disable password never expire on list of users and reset their password. i am unable to find the command for this. can any one guide me for this?

    regards

    Kashan Nawaz

    Saturday, May 16, 2020 9:12 PM

All replies

  • Set-ADUser (for password never expires) and Set-ADAccountPassword (to change password).

    You could have that with a search engine in about 30 seconds!


    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    • Proposed as answer by Vector BCO Sunday, May 17, 2020 7:10 AM
    Sunday, May 17, 2020 2:37 AM
  • Hi,

    Maybe you can try this:

    $users = Get-ADUser -Filter * -Properties * | where {$_.passwordNeverExpires -eq "true" } | Select sAMAccountName 
    foreach($user in $users){Set-ADAccountPassword -Identity $user -reset -NewPassword (ConvertTo-SecureString -AsPlainText "password12345" -Force)
    }

    Really hope that will help you.

    Please let us know if you would like further assistance.

    Best wishes,

    Young Yang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, May 18, 2020 2:27 AM
  • Hi Young,
    Thanks for the response, but this command will work for all of the users, i want to do this with the list of users. i want to call out a csv file in which list of users will be provided and perform the activity on only those users.

    Regards

    Kashan Nawaz

    Saturday, May 23, 2020 1:02 AM
  • Hi Young,
    Thanks for the response, but this command will work for all of the users, i want to do this with the list of users. i want to call out a csv file in which list of users will be provided and perform the activity on only those users.

    Regards

    Kashan Nawaz

    Please take the time to learn PowerShell so you can actually understand the answers and how to ask technical questions.

    Please carefully review the following links to set your expectation for posting in technical forums.


    \_(ツ)_/

    Saturday, May 23, 2020 7:50 AM