Create Active Directory Users with Home Folder

As mentioned many times before, I constantly rebuild my lab and want to automate as much as possible. This applies to Active Directory Users as well.

Helge Klein has already a great blog post on the topic, Creating Realistic Test User Accounts in Active Directory. If you read the comments you will discover that there’s an awesome service online called Fake Name Generator.

Helge’s script create the users, but the HomeShare and the users HomeFolder is not part of the script. I wanted something that does that as well and comply with Permissions that need to be set to allow automate users home directory creations. I also wanted test files to be copied to the users HomeFolder root.

So I reached out to my PowerShell guru Adam Bertram and today I want to share the result with the Community. Enjoy!

First create the CSV file with the Fake Name Generator, make sure to replace the first line with FirstName,LastName.

Place it wherever and change your Parameters.

Now simply run the script and sit back.

Create Active Directory Users with Powershell 01

Create Active Directory Users with Powershell 02

The HomeFolder path is set correctly.

Create Active Directory Users with Powershell 03

The HomeFolder is created with the right permissions and test data are copied to the root of the HomeDrive.

Create Active Directory Users with Powershell 05

Create Active Directory Users with Powershell 08

The Share Permission is set to Authenticated Users.

Create Active Directory Users with Powershell 06

The Users are create in the Organization Unit we specified in the script. Please note that it has to exist or the script will fail.

Create Active Directory Users with Powershell 07

Say what? You like the Organization Unit Structure? Well I’ll give you the script for that as well.

 

 

3 Responses to Create Active Directory Users with Home Folder

  1. Thank you… Greath script. Line 63 … you’d permission …. ‘ sschuold not be there 🙂

Leave a reply