Results 1 to 7 of 7
  1. #1
    Bumbsiii is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default Creating a Group in Active Directory

    Hey Folks,

    I want to simply create a group in my Active Directory via Java and ldap-protocol. Iīve got a connection, can read Groups/Users and so on.
    Do I need any further class libraries or does java offer these options to create a group and Iīm just to stupid to find it?! =P
    I couldnīt find anything about it, yet. I would be very happy if someone could give me an example or just a little hint =)


    Greetings

    Bumbsiii

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    What is your ldap server and what is your ldap client? MS? Apache? Novell?

    I guess this can help:

    Novell Documentation

    Find example:
    'AddEntry.java'

    cheers

  3. #3
    Bumbsiii is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default

    Yeah that worked nice. Had some trouble, because I was to stupid to take the right objectclass but now everything works fine =)

    Thanks, FON =)
    Last edited by Bumbsiii; 11-26-2010 at 01:46 PM.

  4. #4
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    I'm glad i can help :)

    Can you pls share that solution with rest of forum people,
    so they have a reason to read this thread when needed?

  5. #5
    Bumbsiii is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default

    I hope this is enough to explain that =P

    PHP Code:
    public void createGroupsInAD()
        throws LDAPException, UnsupportedEncodingException
      {
        LDAPConnection lc = new LDAPConnection();
    
        lc.connect("10.0.0.64", 389);
    
        lc.bind(LDAPConnection.LDAP_V3, ADMIN_NAME, ADMIN_PASSWORD.getBytes("UTF8"));
    
        try
        {
          LDAPAttributeSet loAttrSet = new LDAPAttributeSet();
          String dn = "cn=Groupname,ou=Security Groups,ou=MyBusiness,dc=OC,dc=local";    
          loAttrSet.add(new LDAPAttribute("objectclass", new String("Group")));
          loAttrSet.add(new LDAPAttribute("name", new String("Groupname")));
          loAttrSet.add(new LDAPAttribute("sAMAccountname", new String("Groupname")));
          loAttrSet.add(new LDAPAttribute("description", new String("All Groupnames")));
          LDAPEntry newEntry = new LDAPEntry(dn, loAttrSet);
    
          lc.add(newEntry);
        }
        catch (Exception e)
        {
          // TODO: handle exception
        }
    
        try
        {
          LDAPAttributeSet loAttrSet = new LDAPAttributeSet();
          String dn = "cn=Groupname2,ou=Security Groups,ou=MyBusiness,dc=OC,dc=local";
          loAttrSet.add(new LDAPAttribute("objectclass", new String("Group")));
          loAttrSet.add(new LDAPAttribute("name", new String("Groupname2")));
          loAttrSet.add(new LDAPAttribute("sAMAccountname", new String("PO_ADMIN")));
          loAttrSet.add(new LDAPAttribute("description", new String("All Groupname2")));
          LDAPEntry newEntry = new LDAPEntry(dn, loAttrSet);
    
          lc.add(newEntry);
    
        }
        catch (Exception e)
        {
          // TODO: handle exception
        }
        lc.disconnect();
      }

  6. #6
    llk_310 is offline Member
    Join Date
    Jan 2011
    Posts
    1
    Rep Power
    0

    Default

    I could not find the LDAP connection classes to compile this. Can you tell me where i can get the classes to compile this code?

  7. #7
    Bumbsiii is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default

    I donīt know exactly which documentation this was.
    It were definitely the novell ldap libraries, I think this one:

    Novell LDAP Extended Library


    Greetings

Similar Threads

  1. Creating File inside a Directory
    By viswanadh7 in forum AWT / Swing
    Replies: 2
    Last Post: 06-27-2013, 07:18 PM
  2. Pulling from an Active Directory
    By Sno in forum New To Java
    Replies: 1
    Last Post: 09-24-2010, 09:15 PM
  3. Accessing Active Directory using JNDI
    By Chandran in forum Advanced Java
    Replies: 0
    Last Post: 02-25-2009, 12:04 PM
  4. Accessing Active Directory
    By javaplus in forum Advanced Java
    Replies: 1
    Last Post: 01-04-2008, 11:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •