PS - Create 100 Test Users


Use the following to create 100 test user accounts. 


################################################
#Create 100 test Users
################################################


Import-Module ActiveDirectory

 $total = 100
 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 "AAaaAAaa11!!11" -AsPlainText -Force) `
   -City "City" `
   -Company "Company" `
   -Country "GB" `
   -Department "Department" `
   -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 "Division" `
   -EmailAddress "$userName@devpetersenit.ltd" `
   -EmployeeNumber "$userID" `
   -EmployeeID "ISED$userID" `
   -Enabled $true `
   -Fax "703-555-$userID" `
   -GivenName "Test" `
   -HomePhone "703-556-$userID" `
   -Initials "TU$userID" `
   -MobilePhone "703-557-$userID" `
   -Name "Test User ($userID)" `
   -Office "Office: $userID"`
   -OfficePhone "703-558-$userID" `
   -Organization "Organization" `
   -Path "OU=O365Test,DC=DOMAIN2,DC=LOCAL" `
   -POBox "PO Box $userID"`
   -PostalCode $userID `
   -SamAccountName $userName `
   -State "VA - Virginia" `
   -StreetAddress "$userID Any Street" `
   -Surname "User ($userID)" `
   -Title "Title" `
   -UserPrincipalName "$userName@devpetersenit.ltd"`
}


  




Comments