Lead Image © Eric Issele, 123RF.com

Lead Image © Eric Issele, 123RF.com

Automate Active Directory management with the Python PyAD library

Snappy Python

Article from ADMIN 78/2023
By
Windows admins can use the Python PyAD library to automate Active Directory configuration and management. Deployment on a Windows server is a snap and paves the way for delegating tedious routine tasks to Python scripts.

PyAD [1] is a useful tool for Active Directory (AD) automation with Python in many environments. However, about two years ago, the developer decided to stop maintaining the open source product. The lack of pull requests in the Git repository shows that the library generally works without problems.

In practice, however, the library needs to be assessed as a potential risk; after all, it does affect Active Directory. Administrators who are not forced to use Python will want to evaluate their alternatives. Moreover, conscientious testing is strongly recommended before rolling out a new Windows Server version.

Getting Set Up

Unix operating systems come with a Python runtime in place out of the box. However, Windows Server 2022, which is used in the following examples, does not have Python support. The Python you need is available from the Python website [2]. For this project, I used the 3.11.3 version current at the time of writing and the Windows Installer for 64-bit architectures. For easier handling, it makes sense to let the installation wizard include the Python EXE file in the server's path. Otherwise, you can work with the Install Now option: You do not need to adjust the default settings of the installation wizard. At the end of the installation, you will want to disable the path length limitations and then restart the server to complete the installation.

The Python development team takes care to make the integration of extensions easy. All of the current crop of Python runtimes come with a package manager that is based on the structure of the defaults known from Linux. The pip command can be used in the following, but watch out: As part of the initial execution, Pip offers to update from version 22.3.1 to 23.1.2 (

...
Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus