Finding disabled users

Welcome Forums General PowerShell Q&A Finding disabled users

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 6 years, 10 months ago.

  • Author
    Posts
  • #6173

    Member
    Points: 0
    Rank: Member

    by Villdyret at 2012-09-03 13:40:14

    Hi. I would like a nice little command that can give me all the users in a spesific OU, with Fullname and Alias.
    I would also like to find all the disabled users, and expired users within the same OU. Can anyone help?

    by mjolinor at 2012-09-03 14:19:02

    Using the AD module comdlets:
    For the first:

    get-ADUser -SearchRoot -properties mailNickname |
    select @{l='Fullname';e={$_.Name}},@{l='Alias';e={$_.mailNickname}}

    For the second:

    Search-ADAccount -SearchBase -AccountDisabled
    Search-ADAccount -SearchBase
    -AccountExpired

The topic ‘Finding disabled users’ is closed to new replies.