Last active
May 4, 2020 20:09
-
-
Save walquis/4549090 to your computer and use it in GitHub Desktop.
Retrieve a photo from Active Directory with ldapsearch (Linux).
This file contains 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
SERVER="dc1.us.yourcompany.com" | |
DN="CN=aUserLogin,OU=SomeOrgUnit,OU=AnotherOrgUnit,DC=dc1,DC=us,DC=yourcompany,DC=com" | |
PASSWORD="aUserLoginsPassword" | |
OU="ou=AnotherOrgUnit,dc=us,dc=yourcompany,dc=com" | |
ldapsearch -h "$SERVER" -p 389 \ | |
-x -D "$DN" -w "$PASSWORD" \ | |
-t -s sub -b "$OU" "(&(objectClass=user)(sAMAccountName=anotherUserLogin))" "thumbnailPhoto" | |
# Or, get all the users in one go... | |
ldapsearch -h "$SERVER" -p 389 \ | |
-x -D "$DN" -w "$PASSWORD" \ | |
-t -s sub -b "$OU" "(&(objectClass=user)(thumbnailPhoto=*))" "sAMAccountName" "thumbnailPhoto" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might be a dumb question, but where are the photos being stored? Is it just the working directory of the bash script?