Quickly Bulk-Create lots of AD Users

Quick blog showing a small script that can bulk create a lot of Active Directory users for you.

I’ve received this query multiple times over the last couple of months - need to provision lots of AD Users quickly for testing. Quick & dirty VB Script below that will create 1000s of users in an AD OU if you wish - though I’d share.

Copy and paste the below in to Notepad, save as VBS, and then modify accordingly. Job done.

DIM oFSO,oShell

SET oFSO=CreateObject("scripting.filesystemobject")
SET oShell=CreateObject("wscript.shell")

DIM oUser, OU
SET OU=GetObject("LDAP://OU=TestUsers,dc=contoso,dc=local")

DIM NoUsers, UserName, count


WHILE NOT Count=NoUsers


SET oUser=OU.Create("USER","CN="&UserName)
oUser.Put "sAMAccountName",UserName
oUser.Put "sn","Surname"
oUser.Put "displayname",Username
oUser.Put "Description","Test User"
oUser.Put "mail",Username&"@Contoso.com"
oUser.SetPassword "FiddleSticks"

wscript.echo "Finished."



Bits in BOLD you need to edit:

SET OU=GetObject("LDAP://OU=TestUsers,dc=contoso,dc=local")
Change the OU path here to match your system - I.e. where you want the users creating.

Set this to the number of users you want to create - in this case 4,500.

oUser.SetPassword "FiddleSticks"
Here, it’s important you set a password that will pass the security standards for the domain, otherwise the user won’t be created.

Anyways, quick and easy, just how I like it. The above will create however many accounts you need with an incremental name of TestX, where X is the increment.

blog comments powered by Disqus