##################################################################### # Written by Rikard Strand # Script provided AS IS without warranty of any kind ##################################################################### # Import AD module Import-Module ActiveDirectory ##################################################################### ### Variables to edit : START # UPN Suffix (set to a valid UPN Suffix) $upnsuffix = "domain.com" # OU to create in (set to a valid OU) $OU = "OU=TEST,DC=domain,DC=com" # How many users do you want to create $total = 6689 ### Variables to edit : END ##################################################################### # Generate first name, add more names if needed $fn=@() $fn="Mary","Patricia","Linda","Barbara","Elizabeth","Jennifer","Maria","Susan","Margaret" $fn+="Dorothy","Olivia","Isabella","Fiona","Sarah","Angelina","Angela","Jasmine" $fn+="Jacob","Mason","Ethan","Noah","William","Liam","Jayden","Michael","Alexander" $fn+="Aiden","Mateo","Nicolás","Alejandro","Samuel","Diego","Daniel","Benjamín","Lucas" $fn+="Joshua","Gary","Patrick","Eric","Albert","Keith","Ralph","Will","Samuel","Roy" $fn+="Derek","Herman","Clyde","Glen","Hector","Shane","Ricardo","Dan","Dean","Edwin" $fn+="Jake","Marco","Drew","Jody","Al","Nicolas","Owen","Sandra","Jennifer","Amy" $fn+="Jill","Veronica","Rihanna","Madonna","Eva","April","Dolores","Lynn","Annette" $fn+="Marion","Erica","Sherri","Sabrina","Hilda","Nora","Nina","Leah","Carole","Olga" $fn+="Angelina","Ginger","Brooke","Rachael","Kari","Estelle","Mable","Krystal","Lynette" $fn+="Kevin","Daniel","Jayden","Matthew","Bruce","Adam","Don","Floyd","Tim","Doris" $fn+="Alice","Kelly","Judy","Brenda","Holly","Jeanette","Emma","Esther","Carrie","Elaine" $fn+="Billie","Violet","Tracey","Becky","Sheryl","Ada","Isabel","Paulette","Nikki" $fn+="Rhonda""Tammie","Patrice","Stacie" # Generate sur name, add more names if needed $sn =@() $sn="Smith","Martin","Patel","Taylor","Wong","Campbell","Williams","Thompson","Jones" $sn+="Brown","Clark","Jackson","Lewis","Walker","Perez","Mitchell","Cussler","Edwards" $sn+="Lee","Cruz","Morgan","Peterson","Cook","Cox","Price","Myers","Foster","Ross" $Sn+="Wilson","White","Rose","Quinn","McLaughlin","Campbell","Brown","Stewart","Russel" $Sn+="Green","Harris","Copper","King","Hall","Ward","Carter","Patel","Allen","Murray" $Sn+="Gardner","Walsh","Fox","Wolf","Bear","Lloyd","Robertson","Graham","Cole","Ali" $Sn+="Webb","Watts","Poole","Foxhound","Hussain","Mason","Rogers","Ellis","Russel" $Sn+="Bush","Franklin","Young","Knight","Spencer","Griffin","Hogwarths","Potter" $Sn+="Kobben","Dolstra","Salt","Pepper","Dolan","Swan","Fountain","Beck","Denton" $Sn+="Pitt","Crane","Bowes","Bonner","York","McIellan","Froigh","Duff","Hale" $Sn+="Florez","Fortin","Moore","Carter","Hill","Chapman","Gill","West","East","North" $Sn+="Ryan","Barker","Jenkins","Lawson","Bulter","Kahn","Simpson","Saunders","Kennedy" $Sn+="Kingston","Powell","van Dam","Castle","Hull","Proctor","Keeling","Rich" $Sn+="Millington","Nairn","Dickens","Bouvet","Knott","Nolan","South" # Generate City $city=@() $city="London","Manchester","Las Vegas","Miami","Dubai","Hong Kong" $city+="Beijing","Cairo","Jakarta","Lagos","Mexico City","New York","Moscow","Seoul" $city+="Istanbul","Copenhagen","Tokyo","Rio de Janeiro","Bahamas","Ottawa","Quebec" $city+="Baltimore","Bangkok","Berlin","Brussels","Budapest","Damascus","Dublin" $city+="Kuala Lumpur","Nice","Paris","Osaka","Montreal","Milan","Helsinki","Glasgow" $city+="Shenzhen","Oslo","Stockholm","Roma","Madrid","Barcelona","Cannes","Luxembourg" $city+="Hamburg","Kiev","Manila" # Generate Department $depnames=@() $depnames="Sales","Finace","Humans Services","Education","Defence","Support" $depnames+="Health care","Service Delivery","Claims","HR","Agents","" # Generate Titles $titlenames=@() $titlenames="Consultant","Senior Consultant","Micro manager","Traniee","" $titlenames+="Manager","Assistant","Apostle","Shogun","Talent","Star" # Create the users for ($userIndex=0; $userIndex -lt $total; $userIndex++) { $userID = "{0:0000}" -f ($userIndex + 1) $userName = "test$userID" $given = $fn[(Get-Random $fn.count)] $sur = $sn[(Get-Random $sn.count)] $c = $city[(Get-Random $city.count)] $dep = $depnames[(Get-Random $depnames.count)] $title = $titlenames[(Get-Random $titlenames.count)] write-host $userID" | Creating "$given $sur "a" $title "in" $dep "@" $c New-ADUser ` -AccountPassword (ConvertTo-SecureString "Pass123." -AsPlainText -Force) ` -City $c ` -Company "The Global company" ` -Department $dep ` -Description ("TEST ACCOUNT " + $userID + "(User is meant for test purposes)")` -EmailAddress "$userName@theglobalcompany.test" ` -EmployeeNumber "$userID" ` -EmployeeID "ISED$userID" ` -Enabled $true ` -Name "$given $sur ($userID)" ` -GivenName $given ` -Surname $sur ` -DisplayName "$given $sur ($userID)" ` -HomePhone "703-556-$userID" ` -MobilePhone "703-557-$userID" ` -Path $OU ` -POBox "PO Box $userID"` -PostalCode $userID ` -SamAccountName $userName ` -StreetAddress "$userID Global street" ` -Title $Title ` -UserPrincipalName $userName"@"$upnsuffix } # List all the users (requires PowerShell ISE environment) get-aduser -filter * -SearchBase "$OU" -Properties * | Out-GridView
Creating test users in Active Directory (Powershell)
I needed some test accounts to a DEMO / LAB environment today but with somewhat real names. I wrote the following Powershell script (requires ActiveDirectory module).
No comments:
Post a Comment