Create Contoso Users in Active Directory

Create Contoso Users in Active Directory This script creates 270 + users in Active Directory copied from the Contoso WorkerInformation Environment.

3.1 Star
2,985 times
Add to favorites
Active Directory
E-mail Twitter Digg Facebook
  • BUG-Report: Script fails for long domain names
    1 Posts | Last post July 29, 2015
    • Hi Roberto,
      I just used your script (again) to rapidly configure a demo. It is surely great for that.
      But I noticed a small issue: Your script only works for short domain names like my-forst.tld or Here are the lines that cause the problem:
      $split = $dnsDomain.split(".")
      if ($split[2] -ne $null) {
      	$domain = "DC=$($split[0]),DC=$($split[1]),DC=$($split[2])"
      } else {
      	$domain = "DC=$($split[0]),DC=$($split[1])"
      And here is my fix for it:
      $split = $dnsDomain.split(".")
      foreach($part in $split)
          if($domain -ne $null)
          $domain += "DC=$part"
      If you like my solution, I would appreciate an update of your script.
      Greetings from Germany,