Observed since 20 Oct, 19:56 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Modern Active Directory user management tool with conflict resolution
Modern Active Directory user management tool with conflict resolution, supporting both domain controller (PowerShell) and remote LDAP operations.
pip install ad-user-manager
When running directly on a domain controller, the tool automatically uses PowerShell for optimal performance:
from ad_user_manager import ADConfig, DCServerConfig, create_ad_manager
# Configure for domain controller
config = ADConfig(
server=DCServerConfig(
connection_type="domain_controller",
base_dn="CN=Users,DC=example,DC=com",
use_current_credentials=True # Use current user's AD credentials
)
)
# Create user
with create_ad_manager(config) as manager:
result = manager.create_user(
username="jdoe",
first_name="John",
last_name="Doe",
email="john.doe@example.com",
resolve_conflicts=True
)
print(f"Created user: {result.username}")
For remote connections to Active Directory:
from ad_user_manager import ADConfig, LDAPServerConfig, create_ad_manager
# Configure for LDAP connection
config = ADConfig(
server=LDAPServerConfig(
connection_type="ldap",
host="dc.example.com",
port=389,
use_ssl=False,
bind_dn="CN=service-account,CN=Users,DC=example,DC=com",
bind_password="your-password",
base_dn="CN=Users,DC=example,DC=com"
)
)
# Create user
with create_ad_manager(config) as manager:
result = manager.create_user(
username="jsmith",
first_name="Jane",
last_name="Smith",
email="jane.smith@example.com"
)
# Domain controller mode
ad-user-manager create-user -u jdoe -f John -l Doe -e john.doe@example.com
# With conflict resolution
ad-user-manager create-user -u jdoe -f John -l Doe -e john.doe@example.com --resolve-conflicts
# Dry run mode
ad-user-manager create-user -u jdoe -f John -l Doe -e john.doe@example.com --dry-run
ad-user-manager search-user -u jdoe
ad-user-manager test-connection
ad-user-manager suggest-usernames -f John -l Doe
# LDAP Configuration
export AD_CONNECTION_TYPE=ldap
export AD_HOST=dc.example.com
export AD_PORT=389
export AD_USE_SSL=false
export AD_BIND_DN="CN=service-account,CN=Users,DC=example,DC=com"
export AD_BIND_PASSWORD="your-password"
export AD_BASE_DN="CN=Users,DC=example,DC=com"
# Domain Controller Configuration
export AD_CONNECTION_TYPE=domain_controller
export AD_BASE_DN="CN=Users,DC=example,DC=com"
export AD_USE_CURRENT_CREDENTIALS=true
Create a .env file or use environment variables:
# For LDAP mode
AD_CONNECTION_TYPE=ldap
AD_HOST=dc.example.com
AD_BIND_DN=CN=service-account,CN=Users,DC=example,DC=com
AD_BIND_PASSWORD=your-password
AD_BASE_DN=CN=Users,DC=example,DC=com
# For DC mode
AD_CONNECTION_TYPE=domain_controller
AD_BASE_DN=CN=Users,DC=example,DC=com
AD_USE_CURRENT_CREDENTIALS=true
The tool automatically detects username conflicts and generates alternatives:
# Automatic conflict resolution
result = manager.create_user(
username="jdoe", # If exists, might become "jdoe1", "jdoe2", etc.
first_name="John",
last_name="Doe",
email="john.doe@example.com",
resolve_conflicts=True
)
print(f"Final username: {result.username}")
print(f"Conflicts resolved: {result.conflicts_resolved}")
result = manager.create_user(
username="jdoe",
first_name="John",
last_name="Doe",
email="john.doe@example.com",
additional_attributes={
"department": "Engineering",
"title": "Software Developer",
"telephoneNumber": "+1-555-0123"
}
)
config = ADConfig(
server=your_server_config,
log_level="DEBUG", # DEBUG, INFO, WARNING, ERROR, CRITICAL
log_format="json" # "json" or "console"
)
git clone https://github.com/your-org/ad-user-manager.git
cd ad-user-manager
pip install -e ".[dev]"
pytest
# Linting
ruff check .
# Formatting
black .
# Type checking
mypy .
The project is organized into focused modules:
models.py - Data models and configuration schemaspowershell_manager.py - PowerShell-based AD operations (DC mode)ldap_manager.py - LDAP-based AD operations (remote mode)factory.py - Manager creation and auto-detectionconfig.py - Configuration managementvalidators.py - Input validation and conflict resolutionexceptions.py - Custom exception hierarchycli.py - Command-line interfaceutils.py - Utility functionsThis project is licensed under the MIT License - see the LICENSE file for details.
For issues, feature requests, or questions:
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.0 | 16 Jul 2025 | 12 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:56 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:ec906f0d3f7e1565c89e1fb18c908559f0fce101ccd65821ebf6df32680f287f