For a task at work I had to create a number of users in Active Directory for a demo environment I had to set up. I didn’t really want to do this manually, and I wanted something more realistic than ‘DemoUser 01’, ‘DemoUser 02’ and so on.
I found an online API to generate random, but realistic user data, and decided to create a wrapper function to quickly get user data.
I then created a simple script to use this data to create demo users in Active Directory. I thought this might be of interest to others, so decided to share it here on my blog.
The code could probably be more polished, but as this was for a demo environment I decided that this would be enough. If you take my code and improve on it, please let me know! 🙂
First the wrapper function to get user data from randomuser.me.
This is the code that I used to create the demo users.
Unfortunately the password returned with the API is not always strong enough for Active Directory, so I decided to hard code it. These are demo users so having the same password for all users isn’t an issue.
I hope this have been helpful. Please leave any comments below.