Announcement

Collapse
No announcement yet.

Creta AD users 12345 to 55555

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creta AD users 12345 to 55555

    Hi.
    Looking for a script that will create users in AD. For example, from user name aaaa to username cccc.

    so i will have
    aaaa
    aaab
    aaac
    etc...

    acounts should also be enabled...

    any ideas?
    Visit iCount
    Visit MSEC
    Visit LCS-GUIDES.COM
    Visit Melariche

  • #2
    i actually have this:

    Code:
    Set objRootDSE = GetObject("LDAP://rootDSE")
    
    Set objContainer = GetObject("LDAP://cn=Users," & _
        objRootDSE.Get("defaultNamingContext"))
     
    For i = 111111 To 111150
        Set objLeaf = objContainer.Create("User", "cn=name" & i)
        objLeaf.Put "sAMAccountName", "UserNo" & i
        objLeaf.SetInfo
    Next
     
    WScript.Echo "1000 Users created."
    but the accounts are created as disabled...
    what do i need to add in order for them to be enabled?

    thanks...
    Visit iCount
    Visit MSEC
    Visit LCS-GUIDES.COM
    Visit Melariche

    Comment


    • #3
      You're smart this script are from here:

      http://www.microsoft.com/technet/scr.../usmgvb03.mspx

      I know this one

      You need this on as well

      Set objUser = GetObject _
      ("LDAP://cn=USERNAME,ou=management,dc=fabrikam,dc=com")

      objUser.AccountDisabled = FALSE
      objUser.SetInfo
      MCSE w2k
      MCSA w2k - MCSA w2k MESSAGING
      MCDBA SQL2k

      Comment


      • #4
        Here is a piece of code that I usually use:
        Code:
        'Bulk user creation script
        
        Set oRoot = GetObject("LDAP://rootDSE")
        Set oDomain = GetObject("LDAP://" & oRoot.Get("defaultNamingContext"))
        
        Set oOU = oDomain.Create("organizationalUnit", "ou=MailRelay")
        oOU.Put "Description", "OU for creating mail relay test users"
        oOU.SetInfo
        
        For i=100 to 200
        	Set oUser = oOU.Create("User", "CN=User" & i)
        	oUser.Put "sAMAccountName", "User" & i
        	oUser.Put "userprincipalname", "User" & i & "@netguru.co.il"
        	oUser.Put "DisplayName", "User" & i
        	oUser.Put "sn", "Relay_" & i
        	oUser.Put "givenName", "Mail"
        	oUser.Put "mail", "MailRelay_" & i & "@netguru.co.il"
        	oUser.Put "Description", "Mail relay test user #" & i
        	oUser.SetInfo
        	oUser.SetPassword "Wind0ws2003"
        	oUser.AccountDisabled = False
        	oUser.SetInfo
        Next
        ** Moderators note **
        Some scripts posted before August 12 2005 might possibly be corrupted, due to a forum migration we had on that date.
        This caused a replacement of two particular signs to their HTML-code substitute.

        To Fix this:
        Copy and paste the code as usual.
        - Then Replace & with &
        - And also Replace &lt; with <
        Last edited by Rems; 24th March 2008, 23:00. Reason: ** moderators note **
        Guy Teverovsky
        "Smith & Wesson - the original point and click interface"

        Comment


        • #5
          yup
          thanks guys.

          problem solved...
          Visit iCount
          Visit MSEC
          Visit LCS-GUIDES.COM
          Visit Melariche

          Comment

          Working...
          X