Fetching information from Active Directory using Python

0.00 avg. rating (0% score) - 0 votes

Here are two simple scripts written in Python to fetch information about users from Active Directory. The AD schema has been augmented with the Microsoft Services For Unix schema, which will allow to map Unix uids to Windows user accounts.

All you need to do is to fill in your own domain controller, AD distinguished name (user account) and the password for it in /etc/ad.secret. You shoud use a less privileged account than Administrator for security. Also remember to set the permissions for ad.secret so that only privileged users have access.

This one will fetch the real name of a user when given a Unix uid:

And this one will do the same for e-mail:

Leave a Reply