Created
December 21, 2012 10:21
-
-
Save mikeplate/4351975 to your computer and use it in GitHub Desktop.
Active Directory User Handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # List all users | |
| $filter = "(&(objectClass=user)(objectCategory=person))" | |
| $users = ([adsiSearcher]$filter).findall() | |
| $users | %{ $_.Properties['displayname'] } | |
| # Sort | |
| $users | %{ $_.Properties['displayname'] } | sort | |
| # Filter by part of name | |
| $users | %{ $_.Properties['displayname'] } | where { $_ -match "John" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment