Comments (6)

  1. JR_MS says:

    @Ashish – I hope you understand that expiring accounts is different from password expiry.
    In your case you could do the below.
    On a Win dows 7 Client Open PowerShell as Administrator
    Import-Module ActiveDirectory
    Get-AdUser -Filter { (passwordlastset -notlike "*" -OR Passwordlastset -lt $days) } -properties * | select name,mail,distinguishedname | export-csv C:Users_WithPassowrd_Expiring_In30days.csv -notypeinformation

  2. ashish_1 says:

    This script does not populate the csv file. It completes with no errors. I am not trying to email anything for now, just want to have the csv file populated with expiring passwords (ie 30 days). Did it work for you?

  3. mike says:

    Works nicely for me! Thanks

  4. r4ravi says:

    thanks I will have a look into this

  5. Tanweer says:

    Thanks a lot.. it is working for me

  6. Benjamin Horton says:

    If you could also list the expiring account’s manager in the email that would be great. Once the email is generated I have to figure out the managers responsible for the account and ask for permission to extend account. Excellent set of instructions by
    the way!!!