Active directory object generator

  • Thread starter Thread starter Dim_User_As_Jim
  • Start date Start date
D

Dim_User_As_Jim

Guest
I dont have a question about this, but wanted to post something since ive gotten so much help from this forum.
----------

This program creates objects into AD from a txt file which is provided for it.

I made one for testing purposes, havent tested it on anything else than contact lists, but should accept "user","group","organizationalunit" over the "contact" which is coded in.

Most of the settings you can change on the fly without re-compiling.

The list.txt is in format "CACAL - Calgary,Canada" - I use the first 5 letters for the name of the contact list and the rest for description.

I use a static path to the DC, but getting the domainname through rootdse isnt a problem. (seems that the DCs have to have SP2 or 3 before this works without problems)
also the ip or hostname for the DC

Code:
        Dim tmp As String
        Dim oContainer As IADsContainer
        Dim ocont As IADs
        oContainer = GetObject("LDAP://x.x.x.x/ou=abc,ou=def,ou=Common,dc=corporation,dc=com")
        FileOpen(1, "list.txt", OpenMode.Input, OpenAccess.Read)
        While Not EOF(1)
            tmp = LineInput(1)
            ocont = oContainer.Create("Contact", "cn=" & Microsoft.VisualBasic.Left(tmp, 5))
            ocont.Put("Givenname", Microsoft.VisualBasic.Left(tmp, 5))
            ocont.Put("description", Microsoft.VisualBasic.Right(tmp, tmp.Length - 8))
            ocont.SetInfo()
            ocont = Nothing
        End While
        FileClose(1)
        MessageBox.Show("Havoc generated :)")
 

Similar threads

Back
Top