I recently had to troubleshoot an issue with the User Profile Service Application and needed to build a repro environment, as part of this I needed to create a large number of users in AD to import into the UPA (too many to do manually using AD Users and Computers!). I thought, there has got to be an easy way using PowerShell - and there is using the Active Directory PowerShell module and the New-ADUser cmdlet.
The script below will create 1000 users in AD (update the $NumAccounts variable if you need more). It will prompt for a password, this password will be used for all of the accounts. I tested the script on Windows Server 2008 R2, it should also work on Windows Server 2012. The script can either be run from a DC or a server with the Remote Server Administration Tools (RSAT) feature enabled.
$Password = Read-Host -AsSecureString
$NumAccounts = "1000"
$i = 0
While ($i -le $NumAccounts)
Write-Host "Creating User" $i
New-ADUser -Name ("User" + $i) -AccountPassword $Password -PasswordNeverExpires $true -Enabled $true