Skip to content

Create 1 of more test users in Active Directory

A simple vb script to create 500 test users.

You must configure your domain info, and how many users you would like to create

 


dim strUser
Dim objRootLDAP, objContainer, objNewUser, objGroup

set objRootLDAP = GetObject("LDAP://rootDSE")
set objContainer = GetObject("LDAP://cn=Users," & _
   objRootLDAP.Get("defaultNamingContext"))

set objGroup = GetObject(LDAP://CN=Users,DC=DOMAIN,DC=COM)

‘Modify number of users to create
for i = 01 to 500

  strUser = "USER NAME" & i
  set ObjNewUser = objContainer.Create("User", "cn=" & strUser)
  objNewUser.Put "sAMAccountName", strUser
  objNewUser.Put "cn", strUser
  objNewUser.Put "givenName", strUser
  objNewUser.Put "displayName", strUser
  objNewUser.Put "userPrincipalName", strUser & "@FQDN"
  objNewUser.SetInfo

  objNewUser.SetPassword("PASSWORD")
  objNewUser.AccountDisabled = FALSE
  objNewUser.SetInfo
  objNewUser = null

Next

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS

Follow

Get every new post delivered to your Inbox.