msad-query - Microsoft Active Directory Query
Simple wrapper to perform Windows Powershell-based AD User Querys
Usage
Use any of the three methods provided to get domain records returned:
- getUser
- getAllUsers
- getGroupUsers
from msad_query import getUser
import json
record = getUser(accountId="jdoe", domainServer="<your domain server name>")
print(json.dumps(record, indent=4))
Response record:
{
"distinguishedName": "CN=John Doe,OU=Users,OU=Company,DC=corp,DC=local",
"enabled": true,
"givenName": "John",
"name": "John Doe",
"objectClass": "user",
"objectGUID": "54c6640e-a597-45ad-974e-170d53afbb1a",
"samAccountName": "jdoe",
"sID": "S-1-5-21-3691830899-5239577749-90497688-2222",
"surname": "Doe",
"userPrincipalName": "jdoe@company.com"
}
The response for the other methods are lists of the same format.
Installation
Prerequisites
The machine running this is assumed to be a Windows machine. The Windows Feature 'RSAT-AD-PowerShell' must be installed. This can be installed from within Powershell with the following command:
Install-WindowsFeature -Name "RSAT-AD-PowerShell" -IncludeAllSubFeature
Using In Projects
Installation:
pip install msad-query
Cloning For Development
Set up a virtual environment. Once an environment is set up, activate it and add dependencies with the following:
pip install -r requirements/dev.txt
The dev.txt file includes:
- BLACK, a code formatter, see notes at the bottom of this file for details
- setuptools, which provides the support for the building of the package
To run tests:
python -m unittest discover -s tests/
Code Formatting
Code formatting is done using BLACK. BLACK allows almost no customization to how code is formatted with the exception of line length, which has been set to 119 characters.
Use the following to bulk format files:
black . -l 144
Creating A New Release
Please do the following when making a new release, most are documented above:
- Run tests
- Code format
- Be sure to update the change log and _metadata.json with version and notes
- git add, commit, and push changes
- run the following code to generate a wheel:
python -m build
Metadata
Release files for msad-query 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msad_query-1.2.0.tar.gz | 5.9 kB | With provenance | Details for msad_query-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msad_query-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for msad_query-1.2.0-py3-none-any.whl |
Total release size: 12.2 kB
Release files / msad_query-1.2.0.tar.gz
| Download URL | msad_query-1.2.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e90afcb48498d8197b52c55152fc27ddf9f2ec8951a30dc393db94d34efaff2c
|
|
BLAKE2b-256 checksum How to use checksums |
943b683510ea78e0bac4fd9e512d783baf4be86947e87682b47eaa610e025f02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency logRelease files / msad_query-1.2.0-py3-none-any.whl
| Download URL | msad_query-1.2.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bbc1c0e839f7fccfdea5a5202aec6d3bc0aa625f284a1ad540d993143398fd7
|
|
BLAKE2b-256 checksum How to use checksums |
9e4ce54ec059dcda3a2885071354f3ae0de736fbb4b148b04ad4f6eab134b33c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency logSecurity for msad-query 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for msad_query-1.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.