Comments (6)

  1. Anonymous 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
    $days=(Get-date).AddDays(-30)
    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 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!!!