infamousjoeg
3/31/2017 - 7:28 PM

Create 1,000 Test Users for Home Lab

Create 1,000 Test Users for Home Lab

Import-Module ActiveDirectory

 $total = 1000
 for ($userIndex=0; $userIndex -lt $total; $userIndex++) 
 { 
  $userID = "{0:0000}" -f ($userIndex + 1)
  $userName = "test.user$userID"

  Write-Host "Creating user" ($userIndex + 1) "of" $total ":" $userName

  New-ADUser `
   -AccountPassword (ConvertTo-SecureString "Cyberark1" -AsPlainText -Force) `
   -City "Tampa" `
   -Company "CyberArk Software" `
   -Country "US" `
   -Department "QA" `
   -Description ("TEST ACCOUNT " + $userID + ": This user account does not represent a real user and is meant for test purposes only")`
   -DisplayName "Test User ($userID)" `
   -Division "Americas" `
   -EmailAddress "$userName@joe-garcia.local" `
   -Enabled $true `
   -Fax "813-555-$userID" `
   -GivenName "Test" `
   -HomePhone "813-556-$userID" `
   -Initials "TU$userID" `
   -MobilePhone "813-557-$userID" `
   -Name "Test User ($userID)" `
   -Office "US-Southeast"`
   -OfficePhone "813-558-$userID" `
   -Organization "CyberArk Software" `
   -Path "CN=Users,DC=joe-garcia,DC=local" `
   -PostalCode "33601" `
   -SamAccountName $userName `
   -State "FL – Florida" `
   -StreetAddress "$userID Kennedy Blvd" `
   -Surname "User ($userID)" `
   -Title "QA Analyst" `
   -UserPrincipalName "$userName@joe-garcia.local"
 }