This script will automate different administration tasks of Active Directory Management.
I have developed these functionalities for this demo project
- create a group
- unlock locked users
- create and activate users using a CSV file
- delete users using a CSV file
- activate users using a CSV file
-
install Python
-
install needed packages
- install pip
python -m ensureip --upgrade
- install ldap3 package // source : LDAP3
pip install ldap3
- install python-dotenv package // source : Python-dotenv
pip install python-dotenv
- create a .env file in the root directory with your own data :
SERVER=ipAddress or hostName USER=username
PASSWORD=YourWonderfulPassword
SEARCHDC=,DC=company,DC=com
COMPANY=Company
DOMAIN=company.com
TEMPUSERSPASSWORD=BeautifulTempPassword -
AD controller must accept SSL/TLS connection otherwise password creation won't work and users will have an empty password
You can find csv examples files in the CSV_example_files folder
- csv for user creation:
- FIRSTNAME, LASTNAME, ADDRESS, PHONE, ORGANISATIONAL UNIT
- csv for user deletion or activation:
- SAMACCOUNTNAME, OU
Log of each operation is in the appropriate text file in "logs" directory.
python main.py