The purpose of this script is to add bulk users to Windows Active Directory by using either a CSV or a JSON file
Follow the format as presented in the JSON sample file, it is quite self-explanatory. You will be prompted whether or not you want to create a default password for all users or whether you want to type them in individually. I have removed the option to read unique passwords from plaintext in a file since it is awful OPSEC. If you want to do that, for lab-purposes as an example, then you can look up versions of the script older than 11/1/2023.
Make sure that the organization structure, OU's and groups, have been defined and created prior to running the script The script now scrapes the file for OU's and Groups and checks them against groups that already exist. If the user is a part of a group that doesn't exist the script prompts whether or not to create a new OU.
Modify the addAdUsers.json folder
Edit the relevant details. Note the formatting for the "OU=ouUnit" and "DC=Domain,DC=DomainSuffix"
And for christ's sake, please change the details if you're using this for a school submission. You don't wanna get pinged for plagiarism
Make sure you haven't changed the filenames
Run the script from the folder with admin/escalated privileges (even if you're logged in as admin)
cd .\Your\Directory
.\addAdUsers.ps1
- Need to create a basic modification to handle different input formats (csv, xml, sql, mongoDB etc.)
Drop the .CSV format, it is an objectively horrible formatting standardNoBasic error handling codeNoSome checking for edge casesNo handling of duplicate usersOU's and Groups need to be created prior to running the script
Provide handling mechanisms for when OU's don't existDone!Prompt the user on whethere or not they would like for new OU's to be created- Improve prompts. Could do with some more work
- Create utility for Home and Group folder creation with prerequisite permissions
- Create script that serialises, pulls and backs up AD details and configurations, so it can be rebuilt from scratch
- Break script into smaller modules, separated by folders and files
Push JSON file down into a 'samples' directoryConfigure a "Configure Password prompt" at the start, prompt for either "Generic for All" password or "On individual basis"