locked
Password Never Expires RRS feed

  • Question

  • Hello,

    i have this script;

    ------------------------------------------------------------------------------------------------------------------------------

    Import-Module ActiveDirectory
    $Resetpassword = Import-Csv "c:\_Scripts\UserList.csv"

    foreach ($Account in $Resetpassword) {
        $Account.sAMAccountName
        $Account.Password
            Set-ADAccountPassword -Identity $Account.sAMAccountName -NewPassword (ConvertTo-SecureString $Account.Password -AsPlainText -force) -Reset
    }

    -------------------------------------------------------------------------------------------------------------------------------

    Annex to this i also want to enable the "PASSWORD NEVER EXPIRE" option in the user account.

    Monday, May 20, 2019 7:32 PM

Answers

  • Use the -PasswordNeverExpires parameter of the Set-ADUser cmdlet.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by MoVaE Monday, May 20, 2019 9:31 PM
    Monday, May 20, 2019 7:43 PM

All replies

  • Use the -PasswordNeverExpires parameter of the Set-ADUser cmdlet.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by MoVaE Monday, May 20, 2019 9:31 PM
    Monday, May 20, 2019 7:43 PM
  • Always check the help before asking a question.

    help Set-AdUser -online


    \_(ツ)_/

    Monday, May 20, 2019 8:07 PM