Skip to content

kurobeats/Active-Directory-User-Script

Repository files navigation

Active Directory User Script

Original Author: Mark Rhodes - markrhodes@gmail.com - @mrhodes

Overview

This repository contains PowerShell scripts for automating Active Directory tasks including:

  • Creating user accounts from CSV
  • Creating AD groups from CSV
  • Mapping users to groups from CSV
  • Setting up a Domain Controller
  • Promoting users to Domain Admins

Requirements

  • Windows Server 2016, 2019, or 2022
  • Active Directory RSAT tools installed
  • User account with sufficient privileges to perform administrative tasks
  • PowerShell 5.1 or later

Usage

  1. Extract all files to a directory
  2. Run the desired PowerShell scripts from an Administrative PowerShell prompt
  3. Ensure CSV files are properly formatted (see examples in repository)

Script Execution Order

For a new environment, run scripts in this order:

  1. DCSetup.ps1 - Set up the Domain Controller (only on new DC)
  2. dumping-ground.ps1 - Create OUs (optional)
  3. CreateGroups.ps1 - Create AD groups from CSV
  4. CreateUserAccounts.ps1 - Create user accounts from CSV
  5. UserstoGroups.ps1 - Add users to groups from CSV
  6. PromotetoADAdmins.ps1 - Promote specific users to Domain Admins

CSV File Formats

ADUsers.csv

Required columns: Department, Enabled, GivenName, Manager, Name, OfficePhone, SamAccountName, Surname, Title, Password, Email

ADGroups.csv

Required column: Name

ADGrouptoUserMapping.csv

Required columns: Group, SamAccountName

Notes

  • User photos should be placed in the userimages/ folder with filenames matching the user's Name field (e.g., John Smith.jpg)
  • A default user.jpg should be present for users without specific photos
  • Scripts include progress bars for bulk operations

Contributing

Pull requests are welcome! Please ensure scripts are tested in a lab environment before submitting.

About

Create Users in Active Directory This script creates 270 + users in Active Directory.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors