Share via

Powersheel Cmd for exporting CSV file expired AD accounts & disabled AD accounts

Anonymous
2020-05-27T09:13:24+00:00

HI All,

Need help for the subjected query.

How to export the details & how to enable those AD accounts via PowerShell as a domain administrator.

thanks.

Windows for home | Other | Apps

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
  1. Anonymous
    2020-05-27T09:26:53+00:00

    Hello Hashim, i'm Timon and i'm glad to help you.

    You can try with this:

    Disabled Users:

    Search-ADAccount -AccountDisabled -UsersOnly | Select-Object SamAccountName, DistinguishedName | Export-CSV “C:\Temp\DisabledUsers.CSV” -NoTypeInformation

    Expired Users:

    Search-ADAccount -AccountExpired -UsersOnly | Select-Object SamAccountName, DistinguishedName | Export-CSV “C:\Temp\ExpiredUsers.CSV” -NoTypeInformation

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful