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
(12)
2,331 times
Add to favorites
Active Directory
11/18/2015
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • 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 corp.my-forest.tld. 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(".")
      $domain=$null
      foreach($part in $split)
      {
          if($domain -ne $null)
          {
              $domain+=","
          }
      
          $domain += "DC=$part"
      }
      
      If you like my solution, I would appreciate an update of your script.
      
      Greetings from Germany,
      Rabbit@Net