Created
February 4, 2020 16:07
-
-
Save joe-scalise/77225a7ba8f55a9160c7c385c9cbbc5a to your computer and use it in GitHub Desktop.
Simple PowerShell LDAP Query
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
| $user="testerdouglas" | |
| $finalResults = New-Object System.Object | |
| $domain = "LDAP://ldap.example.com/ou=accounts,dc=example,dc=com" | |
| $root = New-Object -TypeName System.DirectoryServices.DirectoryEntry($domain,$null,$null,"Anonymous") | |
| $query = New-Object System.DirectoryServices.DirectorySearcher($root,"(&(objectclass=*)(uid=$($user)))") | |
| $results = $query.findone() | |
| $results.Properties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment