Creating a Real Looking user accounts in Active Directory Labs

To do this I first go to the Fake Name Generator page and select from the menu the Order in Bulk option, click on the checkbox to accept the terms of services and select as output Comma separated (.csv)

Now on step 3, I can select the name set and the country for the account information I want. Once that is selected I then select the following fields:

  • GivenName
  • Surname
  • StreetAddress
  • City
  • Title
  • Username
  • Password
  • Country
  • TelephoneNumber
  • Occupation

Once the fields have been selected I simply specify the number, the email and enter the captcha to get the accounts via email.

Now once I have the CSV in my experience they tend to have repeated usernames, also I have found my self-missing one or more of the fields when I selected what to include in the CSV so I wrote a series of PowerShell functions I can use when working with the data.

The first function is a simple one that allows me to test that the CSV contains all the fields I want. It simply extracts the header from the CSV and checks against a list.

The next function will remove any duplicate username entries, I have found with large samples that it is inevitable for some of the usernames to be duplicated. This function uses a lot the pipeline so as minimize memory use, not the fastest but when dealing with several thousands of fake user details in a VM environment with limited memory it becomes an acceptable tradeoff.

The last function does the importing of accounts from the processed CSV with duplicate usernames removed into a specified OU. The function will create OUs under the specified one for each country in the account set.

The PS1 file with the functions can be found in my GitHub account once you download a copy of it you only need to dot source the file on a PowerShell session on the Windows 2012 R2 domain controller where you want to import the accounts:

Now the functions will be available for you to use in the interactive session. We start by testing the file we got via email to make sure it has all the fields we want and that no mistakes were done when ordering the names:

Now we create a new CSV file with unique usernames:

Once we have the accounts with unique usernames we can import the file into Active Directory:

Once it finishes you should now have a nice set of test accounts in AD for you to use.

Of the 3,000 accounts, only 2,182 where unique when it came to username, still a very good number for testing. In the future, I will probably make it so when it finds accounts with repeated usernames, Surnames or LastNames to add a random string to each.