CreateADUsers provides a powerful framework generating and deploying test user data in an Active Directory environment. These scripts save time, reduce errors, and provide flexibility for testers, IT departments, and homelabbers alike.
Whether you're testing a new system, onboarding employees, or experimenting in a homelab, these scripts are a valuable tool for managing user data efficiently.
-
Active Directory Environment:
- A Windows Server with Active Directory Domain Services (AD DS) installed and configured.
- Administrative access to the domain.
-
PowerShell:
- PowerShell 5.1 or later installed on the server.
- The Active Directory module for PowerShell (installed via RSAT-AD-PowerShell).
-
Python:
- Python 3.x installed (for running the user generation script).
- The faker library installed (pip install faker).
-
Permissions:
- Administrative privileges on the server to create AD users.
- Write permissions to the directory where the CSV file will be saved.
-
Basic Knowledge:
- Familiarity with PowerShell and Python scripting.
- Understanding of Active Directory user management concepts.
There are two ways to install the CreateADUsers repository:
- Direct Repository Sources
- Clone this repository using Git or download the ZIP file.
- Extract the contents of the ZIP file to a directory on your computer.
- Open PowerShell as an administrator and navigate to the directory where you extracted the repo files.
- Run the respective
createusers.pyandaddusers.ps1scripts.
- Download Official Releases from GitHub
- Navigate to the latest release on Github by clicking on Releases (or by clicking here) .
- Download
addusers.exeandcreateusers.exe - Run these respective binary files via your terminal of choice.
The two scripts provided are designed to work together to quickly create and import Active Directory (AD) user accounts in a test environment.
The first script, createusers.ps1, generates randomized CSV data for AD user attributes such as first name, last name, email address, job title, department, etc.
The second script, addusers.ps1, takes the CSV file generated by the first script and uses it to create new AD user accounts in a specified domain.
This script creates random users and their associated data, including a SamAccountName, email address, and password. The script can be run with any number of users as an argument, and will create that many users in a CSV file called "random_users.csv". The script uses the Faker library to generate fake data for each user, and the random module to randomly select a department and office location.
The script requires the following dependencies:
- faker
- random
- sys
- os
- string
To use this script, simply run it with an integer as an argument representing the number of users you want to create. For example, to create 10 users, you can run the script as follows:
python3 createusers.py 10The script will create a CSV file called "random_users.csv" in the current working directory, containing the generated user data. You can open this file using a spreadsheet program or other tool to view and manipulate the data.
This script imports a list of user account details from a CSV file and creates corresponding Active Directory user accounts. It validates prerequisites, including administrative privileges, operating system type, and input data formats, before attempting to create accounts. Accounts are created with attributes such as display name, email address, department, and more.
- Windows Server
- Administrative Privileges
- Active Directory Module for PowerShell
- Domain-Joined Machine
- PowerShell 5.1 or newer
.\addusers.ps1 -CsvPath "C:\path\to\random_users.csv" -Domain "example.com"If successful:
All users created successfully!
If some users fail to create:
Some users failed to create:
User Error
---- -----
jsmith The specified user already exists
Free Custom License (FCL) v1.0
Copyright 2025, Michael Free. All Rights Reserved.
If you encounter any issues while using the tool, please report them in the issue tracker on GitHub. Be sure to include the following information in your bug report:
- The steps to reproduce the issue
- The expected behavior
- The actual behavior
- Any error messages or stack traces associated with the issue
If you have an idea for a new feature, please let me know by creating an issue in the issue tracker on GitHub. Be sure to explain why this feature would be useful and how it could benefit the project.
If you're a developer interested in contributing code to the project, I encourage you to submit a pull request through GitHub. Before submitting your code, please make sure it adheres to my coding standards and passes any automated tests.
Your feedback is valuable to me. If you have any suggestions or ideas for improving the tool, please share them with me through the issue tracker on GitHub or by reaching out to me on Mastodon: https://mastodon.social/@MichaelFree
I appreciate any help testing the project and reporting issues. If you have experience in testing, please let me know by creating an issue in the issue tracker on GitHub or by contacting me directly.
Thank you for your interest in contributing to my project! Your contributions will help make it even better.