I've found a script or two through the news groups (here and on the
WSH group) that allows me to create a couple of thousand users. Now
what I'm trying to figure out is how to get those users to "shuffle"
themselves into one of thirty OU's under the users.

DOM
|_OU1
| |
| |_users
| |_bob
| |_doug
|_OU2
|
|_users
|_bob2
|_doug2

and so on...up to thirty OU's with the 90000 users being placed (or
like cards, "dealt") into one of the thirty groups randomly. What I'm
trying to do is break the AD database, incidentally by seeing how many
"bob's" I can cram into the database.

Here's the script that I've been tinkering with from one of the folks
on the newsgroups.

===================================

For i = 1 To 90000

Set objDomain = GetObject("LDAP://dc=bob,dc=com")
Set objOU = objDomain.Create("organizationalUnit", "ou=OU0" & i)
objOU.SetInfo

Set objUser = objOU.Create("User", "cn=bobby0" & i)
objUser.Put "sAMAccountName", "bobby0" & i
objUser.SetInfo
objUser.AccountDisabled = FALSE
objUser.SetPassword "password"
objUser.Put "pwdLastSet", -1
objUser.AccountExpirationDate = "01/01/2050"
objUser.Put "givenName", "Bobby"
objUser.Put "initials", "B"
objUser.Put "sn", "User"
objUser.Put "displayName", "Bob, Bobby"
objUser.Put "physicalDeliveryOfficeName", "Room 707"
objUser.Put "telephoneNumber", "(320) 762-xxxx"
objUser.Put "mail", "bobby@bobby.com"
objUser.Put "wWWHomePage", "http://www.bob.com"
objUser.SetInfo

Set objUser = objOU.Create("User", "cn=Bob0" & i)
objUser.Put "sAMAccountName", "Bob0" & i
objUser.SetInfo
objUser.AccountDisabled = FALSE
objUser.SetPassword "password"
objUser.Put "pwdLastSet", -1
objUser.AccountExpirationDate = "01/01/2050"
objUser.Put "givenName", "Bob"
objUser.Put "initials", "B"
objUser.Put "sn", "User"
objUser.Put "displayName", "Bob, Bob"
objUser.Put "physicalDeliveryOfficeName", "Room 666"
objUser.Put "telephoneNumber", "(613) 762-xxxx"
objUser.Put "mail", "bob@bob.com"
objUser.Put "wWWHomePage", "http://www.bob.com"
objUser.SetInfo

Next

WScript.Echo "90000 OU's and Users created."

Re: Creating 90000 users and placing randomly them into thirty OU's by Alex

Alex
Sat Aug 30 08:37:58 CDT 2003

Albino Raven wrote:
> I've found a script or two through the news groups (here and on the
> WSH group) that allows me to create a couple of thousand users. Now
> what I'm trying to figure out is how to get those users to "shuffle"
> themselves into one of thirty OU's under the users.

I would do it like this: enumerate your OUs and put them in an array, which
will then have elements with indices 0 through 29. Let's say this array is
called ouArray. Then you can use this function:

Function RandomIntegerInRange(low, hi)
Randomize()
RandomIntegerInRange = Int((hi - low + 1) * Rnd + low)
End Function


and each time you need to get a random ou from the array, get it like this:

ou = ouArray( RandomIntegerInRange(0, 29) )



> DOM
> |_OU1
> | |
> | |_users
> | |_bob
> | |_doug
> |_OU2
> |
> |_users
> |_bob2
> |_doug2
>
> and so on...up to thirty OU's with the 90000 users being placed (or
> like cards, "dealt") into one of the thirty groups randomly. What I'm
> trying to do is break the AD database, incidentally by seeing how many
> "bob's" I can cram into the database.
>
> Here's the script that I've been tinkering with from one of the folks
> on the newsgroups.
>
> ===================================
>
> For i = 1 To 90000
>
> Set objDomain = GetObject("LDAP://dc=bob,dc=com")
> Set objOU = objDomain.Create("organizationalUnit", "ou=OU0" & i)
> objOU.SetInfo
>
> Set objUser = objOU.Create("User", "cn=bobby0" & i)
> objUser.Put "sAMAccountName", "bobby0" & i
> objUser.SetInfo
> objUser.AccountDisabled = FALSE
> objUser.SetPassword "password"
> objUser.Put "pwdLastSet", -1
> objUser.AccountExpirationDate = "01/01/2050"
> objUser.Put "givenName", "Bobby"
> objUser.Put "initials", "B"
> objUser.Put "sn", "User"
> objUser.Put "displayName", "Bob, Bobby"
> objUser.Put "physicalDeliveryOfficeName", "Room 707"
> objUser.Put "telephoneNumber", "(320) 762-xxxx"
> objUser.Put "mail", "bobby@bobby.com"
> objUser.Put "wWWHomePage", "http://www.bob.com"
> objUser.SetInfo
>
> Set objUser = objOU.Create("User", "cn=Bob0" & i)
> objUser.Put "sAMAccountName", "Bob0" & i
> objUser.SetInfo
> objUser.AccountDisabled = FALSE
> objUser.SetPassword "password"
> objUser.Put "pwdLastSet", -1
> objUser.AccountExpirationDate = "01/01/2050"
> objUser.Put "givenName", "Bob"
> objUser.Put "initials", "B"
> objUser.Put "sn", "User"
> objUser.Put "displayName", "Bob, Bob"
> objUser.Put "physicalDeliveryOfficeName", "Room 666"
> objUser.Put "telephoneNumber", "(613) 762-xxxx"
> objUser.Put "mail", "bob@bob.com"
> objUser.Put "wWWHomePage", "http://www.bob.com"
> objUser.SetInfo
>
> Next
>
> WScript.Echo "90000 OU's and Users created."