Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg
Created March 31, 2017 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infamousjoeg/9b6378dea9212c17660e8ef776166a75 to your computer and use it in GitHub Desktop.
Save infamousjoeg/9b6378dea9212c17660e8ef776166a75 to your computer and use it in GitHub Desktop.
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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment