locked
Set Active directory user account expiration to none RRS feed

  • Question

  • Hello to all,

    Hope you can help me.

    I need to create a powershell script on Active directory server and change users that have an expiration date to none.
    I have a list of all users in csv file.

    I found the command and it is working good on a single user, but i don't know how to do it to for multiple users.
    Clear-ADAccountExpiration -identity "username"

    Can you help me write this script or address me to another site...

    Thank you so much
    Amir 🙂

    Tuesday, January 2, 2018 7:46 AM

Answers

  • Assuming your CSV file has a field with the label sAMAccountName to identify the users, you can use code similar to below:

    Import-Csv c:\users.csv | ForEach
    {
        Clear-ADAccountExpiration -identity $_.sAMAccountName
    }
    


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by Amir Atary Tuesday, January 2, 2018 8:04 AM
    Tuesday, January 2, 2018 7:57 AM