
Active Directory | PowerShell | Automation - Automates domain user and group provisioning, membership management, and multi-workstation local administrator assignments.
Generate identities. Provision the domain. Assign privileges. Manage endpoints.
ADGenesis is a PowerShell-based Active Directory automation project designed to generate domain users and security groups, provision them within an existing Active Directory environment, assign group memberships, and manage local Administrator access across multiple domain-joined Windows workstations.
Built around a JSON-driven workflow, ADGenesis uses a central Management Client (MC) to orchestrate operations across a Domain Controller (DC) and multiple Workstations (WS).
ADGenesis automates two major stages of Active Directory lab management:
randomDomain.ps1Generates randomized:
The generated configuration is exported as a JSON file, separating data generation from actual AD provisioning.
genAD.ps1Consumes the generated JSON and performs the provisioning operations:
All provisioning operations are initiated from the Management Client.
randomDomain.ps1 — Domain Configuration Generator| Feature | Description |
|---|---|
| Random User Generation | Generates unique combinations of first and last names from supplied datasets. |
| Random Group Generation | Selects unique AD group names from the provided group dataset. |
| Password Assignment | Assigns a password to every generated user. |
| Group Assignment | Assigns each generated user to one randomly selected group. |
| Local Admin Selection | Randomly selects a configurable number of users for local administrator privileges. |
| Multi-Workstation Support | Assigns selected users to multiple workstation hostnames. |
| JSON Export | Exports the generated domain configuration to JSON. |
| Input Validation | Validates counts, data availability, and workstation requirements. |
| Output Directory Creation | Automatically creates the output directory when required. |
genAD.ps1 — Active Directory Provisioning Engine| Feature | Description |
|---|---|
| Domain Discovery | Retrieves domain information from Active Directory. |
| DC Selection | Supports specifying a Domain Controller. |
| AD Group Creation | Creates Global Security groups. |
| AD User Creation | Creates enabled domain user accounts. |
| Username Generation | Generates usernames using the first character of the first name followed by the last name. |
| Group Membership | Adds users to their configured AD groups. |
| Local Administrator Assignment | Adds domain users to the local Administrators group on specified workstations. |
| Remote Execution | Uses PowerShell Remoting to perform workstation operations directly from MC. |
| Credential Support | Accepts optional workstation credentials. |
| Undo Mode | Removes generated users, groups, and configured local administrator memberships. |
| Managed Object Identification | Uses a description marker to identify objects created by the script. |
The Management Client acts as the central orchestration point.
MANAGEMENT CLIENT (MC)
┌──────────────────────────────┐
│ │
│ randomDomain.ps1 │
│ genAD.ps1 │
│ │
│ domain.json │
│ │
└──────────────┬───────────────┘
│
┌────────────┴────────────┐
│ │
AD PowerShell PowerShell
/ RSAT Remoting
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────────┐
│ DOMAIN │ │ WORKSTATIONS │
│ CONTROLLER │ │ │
│ │ │ ┌─────┐ ┌─────┐ │
│ AD Users │ │ │ WS1 │ │ WS2 │ │
│ AD Groups │ │ └─────┘ └─────┘ │
│ Memberships │ │ ┌─────┐ │
│ │ │ │ WS3 │ │
└─────────────────┘ │ └─────┘ │
└─────────────────────┘
| Machine | Role | Responsibilities |
|---|---|---|
| MC | Management Client | Runs both scripts, stores JSON, initiates AD and workstation operations. |
| DC | Domain Controller | Hosts Active Directory, users, groups, and directory services. |
| WS1 | Workstation 1 | Domain-joined endpoint. |
| WS2 | Workstation 2 | Domain-joined endpoint. |
| WS3 | Workstation 3 | Domain-joined endpoint. |
ADGenesis uses two independent communication paths:
MC → DC
MC → WS
The workstation operations are initiated directly from MC rather than being relayed through DC. This avoids relying on the MC → DC → WS second-hop credential delegation path.
ADGenesis/
│
├── README.md
├── .gitignore
├── LICENSE
│
├── randomDomain.ps1
├── genAD.ps1
│
└── data/
├── group_names.txt
├── first_names.txt
├── last_names.txt
└── passwords.txt
Adi.com.Adi.Adi.com.The following setup assumes that Windows Server 2022 is already configured as the Domain Controller.
The lab uses the following domain configuration:
| Setting | Value |
|---|---|
| DNS Domain | Adi.com |
| NetBIOS Domain | Adi |
| Example DC hostname | DC1 |
Ensure that AD DS and DNS are operational before proceeding.
Install the Active Directory RSAT tools on Windows 11.
Run PowerShell as Administrator:
Get-WindowsCapability -Online | Where-Object Name -like 'RSAT*'