Author Posts

January 1, 2012 at 12:00 am

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