How do I create a user in active directory?

I've been trying to figure this out and found some tutorials online. I am getting this error:
javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090C26, comment: Error in attribute conversion operation, data 0, v1771
From this code:
try
               String userType = user.getUserType() + "s (dural)";
               LOG.debug("user type is " + userType);
               String groupName = "Thin Client Users";
               Attributes attrs = new BasicAttributes(true);
               attrs.put("objectClass", userType);
               attrs.put("samAccountName", user.getWindowsId());
               attrs.put("cn", user.getCommentString());
               attrs.put("givenName", user.getFirstName());
               attrs.put("sn", user.getLastName());
               attrs.put("displayName", user.getCommentString());
               String userName = String.format(
                         "CN=%s,OU=Staff,OU=%s,DC=elandata,DC=com",
                         user.getCommentString(), user.getUserType());
               int UF_ACCOUNTDISABLE = 0x0002;
               int UF_PASSWD_NOTREQD = 0x0020;
               int UF_PASSWD_CANT_CHANGE = 0x0040;
               int UF_NORMAL_ACCOUNT = 0x0200;
               int UF_DONT_EXPIRE_PASSWD = 0x10000;
               int UF_PASSWORD_EXPIRED = 0x800000;
               attrs.put(
                         "userAccountControl",
                         Integer.toString(UF_NORMAL_ACCOUNT + UF_PASSWD_NOTREQD
                                   + UF_PASSWORD_EXPIRED + UF_ACCOUNTDISABLE));
               Context result = ctxGC.createSubcontext(userName, attrs);
               LOG.info("Creating windows account for: " + userName);
               StartTlsResponse tls = (StartTlsResponse) ctxGC
                         .extendedOperation(new StartTlsRequest());
               tls.negotiate();
               ModificationItem[] mods = new ModificationItem[2];
               String newQuotedPassword = "\"password\"";
               byte[] newUnicodePassword = newQuotedPassword.getBytes("UTF-16LE");
               mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,
                         new BasicAttribute("unicodePwd", newUnicodePassword));
               mods[1] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,
                         new BasicAttribute("userAccountControl",
                                   Integer.toString(UF_NORMAL_ACCOUNT
                                             + UF_PASSWORD_EXPIRED)));
               ctxGC.modifyAttributes(userName, mods);
               LOG.info("Set password & updated userccountControl");
               try
                    ModificationItem member[] = new ModificationItem[1];
                    member[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE,
                              new BasicAttribute("member", userName));
                    ctxGC.modifyAttributes(groupName, member);
                    System.out.println("Added user to group: " + groupName);
               } catch (NamingException e)
                    System.err.println("Problem adding user to group: " + e);
               // Could have put tls.close() prior to the group modification
               // but it seems to screw up the connection or context ?
               tls.close();
               ctxGC.close();
I've tried commenting out the "unicodePwd" attribute since I can't find it on microsoft's website, but still same error.

Are you getting it when creating the subcontext or when modifying the attributes?
And why are you doing that in two steps? Why not just set all the attributes you need before creating the subcontext?
And is there any clue in the exception as to which attribute is wrong?
And have you tried commenting out the attributes one by one to see which it is?

Similar Messages

  • Need Help creating new user in Active Directory

    I am trying to create a new user in active directory via a java application. I have included the code that I am using. I am able to successfully bind to Active Directory. I have been able to change passwords, and delete users, but I have not been able to create a user.
    ldapHost : "mta101.DOM101.CEL.ACC.AF.MIL"
    domainName: "dc=dom101,dc=cel,dc=acc,dc=af,dc=mil"
    existing account: CN=Brett K. Humpherys,OU=Users,OU=CEL
    I get the following error on the createSubcontext statement:
    javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - 00000057: LdapErr: DSID-0C09098B, comment: Error in attribute conversion operation, data 0, v893 ; remaining name 'CN=test1,OU=Users,OU=CEL'
    I have commented out the password portion and change the ObjectCategory to a 32 and get the same error.
        public GblStatus createAccount7(DbaDb dbConn,
                                        String jsrcName,
                                        String personName,
                                        String username,
                                        String password)
          Hashtable ldapEnv = new Hashtable(11);
          ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
          ldapEnv.put(Context.PROVIDER_URL, "ldap://" + this.ldapHost + ":636");
          ldapEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
          ldapEnv.put(Context.SECURITY_PROTOCOL, "ssl");
          ldapEnv.put(Context.REFERRAL, "ignore");
          ldapEnv.put(Context.SECURITY_PRINCIPAL,"cn=" + this.adminAcct + ",cn=users," + this.domainName);
          ldapEnv.put(Context.SECURITY_CREDENTIALS, this.adminPwd);
           try
            // Create the initial context
            DirContext ctx = new InitialDirContext(ldapEnv);
            BasicAttributes attrs = new BasicAttributes();
            BasicAttribute ocs = new BasicAttribute("objectclass");
            ocs.add("top");
            ocs.add("person");
            ocs.add("organizationalPerson");
            ocs.add("user");
            attrs.put(ocs);
            BasicAttribute gn = new BasicAttribute("givenName", "test1");
            attrs.put(gn);
            BasicAttribute sn = new BasicAttribute("sn", "");
            attrs.put(sn);
            BasicAttribute cn = new BasicAttribute("cn", "test1");
            attrs.put(cn);
            BasicAttribute uac = new BasicAttribute("userAccountControl", "66048");
            attrs.put(uac);
            BasicAttribute sam = new BasicAttribute("sAMAccountName", "test1");
            attrs.put(sam);
            BasicAttribute disName = new BasicAttribute("displayName", "test1");
            attrs.put(disName);
            BasicAttribute userPrincipalName = new BasicAttribute
                                          ("userPrincipalName", "[email protected]");
            attrs.put(userPrincipalName);
            BasicAttribute instanceType = new BasicAttribute("instanceType", "4");
            attrs.put(instanceType);
            BasicAttribute objectCategory = new BasicAttribute
                      ("objectCategory","CN=User,CN=Schema,CN=Configuration," + domainName);
            attrs.put(objectCategory);
            String newVal = new String("\"password\"");
            byte _bytes[] = newVal.getBytes("Unicode");
    byte bytes[] = new byte[_bytes.length - 2];
    System.arraycopy(_bytes, 2, bytes, 0, _bytes.length - 2);
    BasicAttribute attribute = new BasicAttribute("unicodePwd");
    attribute.add((byte[]) bytes);
    attrs.put(attribute);
    ctx.createSubcontext("CN=test1,OU=Users,OU=CEL", attrs);
    ctx.close();
    catch (NameAlreadyBoundException nex)
    System.out.println("User ID is already in use, please select a different user ID ...");
    catch (Exception ex)
    System.out.println("Failed to create user account... Please verify the user information...");
    ex.printStackTrace();
    return new GblStatus();
    Any help would be much appreciated.

    Hi .,
    me too got up with same problem., can anyone help me.??
    Someone help me to create attributes in AD using LDAP
    package LDAPpack;
    import javax.naming.*;
    import javax.naming.directory.*;
    import javax.naming.ldap.InitialLdapContext;
    import javax.naming.ldap.LdapContext;
    import java.util.Hashtable;
    class CreateAttrs {
    public static void main(String[] args) {
         Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              env.put(Context.PROVIDER_URL, "ldap://10.242.6.166:389/");
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL, "CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org");
                        env.put(Context.SECURITY_CREDENTIALS, "password-1");
              LdapContext ctx =null;
              try {
                   //ctx = new InitialLdapContext(env,null);
                   try {
    ctx = new InitialLdapContext(env,null);
                   catch(NamingException e) {
    System.out.println("Login failed");
    System.exit(0);
    if(ctx!=null){              
    System.out.println("Login Successful");
    byte[] buf = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; // same data
         // Create a multivalued attribute with 4 String values
         BasicAttribute oc = new BasicAttribute("objectClassNew", "topNew");
         oc.add("personNew");
         oc.add("organizationalPersonNew");
         // Create an attribute with a byte array
         BasicAttribute photo = new BasicAttribute("jpegPhotoNew", buf);
         // Create attribute set
         BasicAttributes attrs = new BasicAttributes(true);
         attrs.put(oc);
         attrs.put(photo);
         Attributes attrs1 = ctx.getAttributes("CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org");
    System.out.println(attrs1);
    Context result = ctx.createSubcontext("CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org", attrs);
    //i got error here; i attach the error below.
         ctx.close();
    System.out.println("close");
         catch(NamingException e){
              e.printStackTrace();
    ERROR:
    Login Successful
    javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090B38, comment: Error in attribute conversion operation, data 0, vece
    ANYONE HELP ME PLS.
    Edited by: vencer on Jun 19, 2008 12:38 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How do you find who created a user in Active Directory?

    I think it would be almost impossible to tell who created an individual AD record, as in my experience there is generally only 1 Domain Admin account for which to create users. 

    So I've done some research and have found LDAP queries that will tell me when a user is created, but not necessarily who created the user. The reason I am asking is because I ran an audit of active and inactive users and between my boss and I (we are a small company so we know all the users) we could not figure out who some of the users were. Thanks for your help!
    This topic first appeared in the Spiceworks Community

  • Error while creating a user in Active Directory.

    Hi Guys,
    I am creating a custom connector for AD and Exchnage , I am able to create user in AD using my Java Code... but i am also getting below error, I want to finish the operation smoothly.... Please find below error logs.
    13:51:15,635 ERROR [STDERR] Data AccessException:
    13:51:15,636 ERROR [STDERR] com.thortech.xl.orb.dataaccess.tcDataAccessException: DB_READ_FAILEDDetail: SQL: select UD_AD_CHILD_GRP_NAME from UD_AD_CHILD where UD_AD_CHILD_KEY = Description: ORA-00936: missing expression
    SQL State: 42000Vendor Code: 936Additional Debug Info:com.thortech.xl.orb.dataaccess.tcDataAccessException
    at com.thortech.xl.dataaccess.tcDataAccessExceptionUtil.createException(Unknown Source)
    at com.thortech.xl.dataaccess.tcDataBase.createException(Unknown Source)
    at com.thortech.xl.dataaccess.tcDataBase.readPartialStatement(Unknown Source)
    at com.thortech.xl.dataobj.tcDataBase.readPartialStatement(Unknown Source)
    at com.thortech.xl.dataaccess.tcDataSet.executeQuery(Unknown Source)
    at com.thortech.xl.dataobj.tcDataSet.executeQuery(Unknown Source)
    at com.thortech.xl.dataaccess.tcDataSet.executeQuery(Unknown Source)
    at com.thortech.xl.dataobj.tcDataSet.executeQuery(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.getChildTableFieldValue(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.getRunTimeValue(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.getRunTimeValue(Unknown Source)
    at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpADDUSERTOADGROUP.implementation(adpADDUSERTOADGROUP.java:49)
    at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.insertResponseMilestones(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.eventPostUpdate(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.update(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.updateSchItem(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.finalizeProcessAdapter(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.finalizeAdapter(Unknown Source)
    at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpCREATEADUSER.implementation(adpCREATEADUSER.java:85)
    at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
    at com.thortech.xl.dataobj.tcORC.insertNonConditionalMilestones(Unknown Source)
    at com.thortech.xl.dataobj.tcORC.completeSystemValidationMilestone(Unknown Source)
    at com.thortech.xl.dataobj.tcOrderItemInfo.completeCarrierBaseMilestone(Unknown Source)
    at com.thortech.xl.dataobj.tcOrderItemInfo.eventPostInsert(Unknown Source)
    at com.thortech.xl.dataobj.tcUDProcess.eventPostInsert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
    at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
    at com.thortech.xl.ejb.beansimpl.tcFormInstanceOperationsBean.setProcessFormData(Unknown Source)
    at com.thortech.xl.ejb.beansimpl.tcFormInstanceOperationsBean.setProcessFormData(Unknown Source)
    at com.thortech.xl.ejb.beans.tcFormInstanceOperationsSession.setProcessFormData(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
    at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    at org.jboss.ejb.Container.invoke(Container.java:960)
    at sun.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
    at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
    at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
    at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
    at $Proxy758.setProcessFormData(Unknown Source)
    at Thor.API.Operations.tcFormInstanceOperationsClient.setProcessFormData(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
    at Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source)
    at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
    at $Proxy803.setProcessFormData(Unknown Source)
    at com.thortech.xl.webclient.actions.DirectProvisionUserAction.handleVerifyProcessData(Unknown Source)
    at com.thortech.xl.webclient.actions.DirectProvisionUserAction.goNext(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
    at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
    at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
    Thanks,
    Hemant

    at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpADDUSERTOADGROUP.implementation(adpADDUSERTOADGROUP.java:49)
    This is definitely a Custom Adapter because OOTB Adapter name is adpADCSADDUSERTOGROUP and NOT adpADDUSERTOADGROUP
    So, it is your custom code and in the code you are passing incorrect value of the Active Directory Child process form...
    The correct name is UD_ADUSRC and the Group Name column name is UD_ADUSRC_GROUPNAME.
    While you are passing UD_AD_CHILD as the child process form and UD_AD_CHILD_GRP_NAME as Group Name column name..
    Use OOTB Adapter... Correct these discrepancies... Your addition of group will work
    And since you are creating custom adapter, you need to be more careful and remain consistent throughout..
    Then if you want to use UD_AD_CHILD_GRP_NAME, use it everywhere consistently... Pass only this value in the adapter...
    And even in lookups, if any... Search everywhere... Keep things consistent... They will work... Because good news is that you are able to create user in AD via Java Code...
    And if any post is even slightly helpful, it is a good habit to mark it with helpful or correct ... And also mark the entire question as answered so that other people also are benefited.

  • How to create user in Active directory

    Hello,
    I'm trying to create a user in active directory via the following example:
    String userName = "cn=Jef Klak,ou=Ps Users,ou=Users,ou=Managed,dc=xxx,dc=local";
         Attributes attrs = new BasicAttributes(false);
         Attribute oc = new BasicAttribute("objectClass");
         oc.add("top");
         oc.add("person");
         oc.add("organizationalPerson");
         oc.add("user");
         attrs.put(oc);
              attrs.put("cn","Jef Klak");
              attrs.put("giveName","Jef");
              attrs.put("sn","Klak");
              attrs.put("displayName","Klak, Jef");
              attrs.put("description","IR");
              attrs.put("userPrincipalName","[email protected]");
              attrs.put("mail","[email protected]");
              attrs.put("company", "XXX");
              attrs.put("sAMAccountName","jk666");
    attrs.put("userAccountControl",Integer.toString(UF_NORMAL_ACCOUNT + UF_DONT_EXPIRE_PASSWD+ UF_ACCOUNTDISABLE));
              Context result = fctx.createSubcontext(userName, attrs);
    As a result I'm getting the following error:
    javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090B38, comment: Error in attribute conversion operation, data 0, vece
    remaining name 'cn=Jef Klak,ou=Ps Users,ou=Users,ou=Managed,dc=xxx,dc=local'
    Anybody any tips or advice on this one? Or maybe a working examples how to add users in AD?
    Listing entries in the AD is no problem, so it's only adding them.
    Many thanks,
    Filip                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

              attrs.put("giveName","Jef");
    javax.naming.directory.NoSuchAttributeExceptionSpelling error.

  • Creating a windows user in Active Directory

    I am trying to create a user in Active Directory that can log on as any other Windows user, but when I try to log into Windows, I get the following error message:
    "The local policy of this system does not allow you to logon interactively".
    Are there any attributes or objectclass settings that must be set for the user to allow interactive logons?
    Thanks in advance!

    This has nothing to do with JNDI, the object class or attributes.
    I assume that you are trying to logon locally to the domain controller with the new user that you have just created.
    By default, the domain controller's policy only allows specific users or members of a group to logon locally at the domain domain controller's console.
    Either edit the domain controller'sgroup policy and add your newly created user to the list of users permitted to logon locally, or add the user to a group which has already been granted permission to logon locally.

  • Saving the password of a user in active directory using java

    Hello, i am trying to use java to build a class that creates a user in Active directory 2012.But the problem is that when the user is created the password is not being saved.
    Can anybody help on this knowing that i tried to save in the fields userPassword and unicodePwd.
    Thanks.

    DirContext ctx = new InitialDirContext(pr);
              BasicAttributes entry = new BasicAttributes(true);
              String entryDN = "cn=CharbelHad,ou=test users,dc=test,dc=dev";
              Attribute cn = new BasicAttribute("cn", "ChHad");
              Attribute street = (new BasicAttribute("streetAddress", "Ach"));
              Attribute loginPreW2k = (new BasicAttribute("sAMAccountName", "[email protected]"));
              Attribute login = (new BasicAttribute("userPrincipalName", "[email protected]"));
              Attribute sn = (new BasicAttribute("sn", "Chl"));
              Attribute pwd = new BasicAttribute("unicodePwd", "\"Ch@341\"".getBytes("UTF-8"));
    Attribute userAccountControl = new BasicAttribute("userAccountControl", "512");
              Attribute oc = new BasicAttribute("objectClass");
              oc.add("top");
              oc.add("person");
              oc.add("organizationalPerson");
              oc.add("user");
              // build the entry
              entry.put(cn);
              entry.put(street);
              entry.put(sn);
              entry.put(userAccountControl);
              entry.put(pwd);
              entry.put(login);
              entry.put(loginPreW2k);
              entry.put(oc);
              ctx.createSubcontext(entryDN, entry);

  • How do I create a user, in my context in OID using the Java API

    How do I create a user, with subschema, in my context in OID using the JAVA API
    I need to be able to create new users in my OID, I was doing it in our old iPlant Directory, but I don't seem to see the same methods in the Oracle LDAP API. I figured out how to get and modify the attributes of a user, but I can't seem to figure out how to add a new one.

    Try this code , modify it accordingly
    ------- cut here -------
    import oracle.ldap.util.*;
    import oracle.ldap.util.jndi.*;
    import javax.naming.NamingException;
    import javax.naming.directory.*;
    import java.io.*;
    import java.util.*;
    public class NewUser
    final static String ldapServerName = "yourLdapServer";
    final static String ldapServerPort = "4032";
    final static String rootdn = "cn=orcladmin";
    final static String rootpass = "welcome1";
    public static void main(String argv[]) throws NamingException
    // Create the connection to the ldap server
    InitialDirContext ctx = ConnectionUtil.getDefaultDirCtx(ldapServerName,
    ldapServerPort,
    rootdn,
    rootpass);
    // Create the subscriber object using the default subscriber
    Subscriber mysub = null;
    String [] mystr = null;
    try {
    RootOracleContext roc = new RootOracleContext(ctx);
    mysub = roc.getSubscriber(ctx, Util.IDTYPE_DN, "o=dec", mystr);
    catch (UtilException e) {
    e.printStackTrace();
    // Create ModPropertySet with user information
    ModPropertySet mps = new ModPropertySet();
    mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"cn", "Steve.Harvey");
    mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"sn", "Harvey");
    mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"uid", "SHarvey");
    mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"givenname", "Steve");
    mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"mail", "[email protected]");
    mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"userpassword", "welcome1");
    // Create the user
    User newUser = null;
    try {
    newUser = mysub.createUser(ctx, mps, true);
    System.out.println("New User DN: " + newUser.getDN(ctx));
    catch (UtilException e) {
    e.printStacktrace();
    ------- end cut --------
    Enjoy.
    Suhail

  • Creating users in Active Directory through LDAP connector

    Hello,
    If we need to create users in Active directory using LDAP connector, what are the options for the following:
    1) Update back into SAP from AD. LDAP connector updates only in one direction i.e from SAP to Active directory.
    2) Can we add additional fields in LDAPMAP which are not standard e.g can we we write our own code to extract data from HR to map the value with an attritube within Active directory?
    Regards,
    Ahmad

    Hello!
    I noticed the email in my inbox and understand the reason for deleting it - checked the rules again - no problem with that.
    Here is the posting again - sanitized this time.
    You can create users in LDAP/AD from SAP without a problem. SAP provides function modules to create/maintain/delete users with LDAP attributes in the correct ou path.
    You can also perform group membership assignment in LDAP from SAP if needed.
    I have done this quite a few times at different companies that use SAP HCM.
    A userid in SAP is created automatically during hiring action with default password e.g. birthday of employee and certain authorization roles based on configured information.
    The userid is then created right away in LDAP in the correct ou path (controlled via custom configuration table) and LDAP group membership is assigned.
    A job runs every 8 hours to perform delta updates in LDAP.
    The userid in SAP and LDAP are locked automatically if the user is terminated using termination action in HR.

  • How do you create a user defined functions  UDF and passing a value like a ID to GEt a Value.

    How do you create a user defined functions UDF and passing a
    value like a ID to GEt a Value.
    using a query.
    are there example.
    Thanks

    tons of examples at cflib.org - good place to start, even
    though many
    udfs there are a bit outdated in their code...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Adding a user in Active Directory

    Hi fellows,
    I am having a serious problem in creating a new user in active directory. i am using LDAP JNDI code. I can delete and update users attributes, but fail to create users.
    ctx.createSubcontext("newuser,full domain", attributes);
    when i specify a new user in "newuser" it gives exception invalidnameexception. I don't understand how to create a new entry within the directory structure of predefined tree. by the way, i can create users by active directory explorer but java application is giving exceptions.
    Any help will be highly appreciated.

    A DistinguishedName is of the form e.g. "cn=username, ou=Users,dc=hostname,dc=com". In other words it contains attribute names and values for each name component. Evidently your DN doesn't do that.

  • Creating group dynamically in active directory depending on their role

    Hi,
    I have sycn oid and active directory using directory integration platform. Now the scenario is We have one system says hr system which take care of entering all the user information. Once it submit that information it goes to oid. Now we want that when we import all that user from oid to active directory it didn't duplicate any user as well as depending on their role it should create groups dynamically in active directory. For e.g: If user belong to Trainee category or manager category it must create Trainee group & Manager group & respective person should go into that group. I don't know whether my question is placed in right group or not. I am using filter to do this task but not able to write proper condition in "source matching filter" and "destination matching rule". Any help will be appreciated.
    Thanks,
    Sonya Sharma

    Thanks Tamim. To clear your thought, i will explain again. I have sync oid and active directory through Directory integration platform. I have created user in oid.(cn=users,dc=mycompany,dc=com). It get sync in active directory properly. Now i have created two group in active directory say for e.g Trainees and Manager. There is a field name position in oid which is a custom attribute. When i fill the information of user in oid, I have to fill "Position" attribute also. So my question is that, if i fill Trainee as a value in Position attribute and click on submit it should go in Trainee Group In active directory and not in user group. Same for manager. How can we achieve this? Can we do it through filter? Or any other way? It's needed desperately. Please help me in resolving this issue.
    Regards,
    Sunil

  • How to check Internet usage userwise in Active Directory ?

    How to check Internet usage userwise in Active Directory ? Without third party software is it possible ?
    Thanks & Regards, Amol . Amol Dhaygude

    Hi,
    Thanks for your comment. 
    The schema is the Active Directory component that defines all the objects and attributes that the directory service uses to store data. 
    Active Directory stores and retrieves information from a wide variety of applications and services. So that it can store and replicate data from a potentially infinite variety of sources, Active Directory standardizes how data is stored in the directory. By
    standardizing how data is stored, the directory service can retrieve, update, and replicate data while ensuring that the integrity of the data is maintained. 
    The directory service uses objects as units of storage. All objects are defined in the schema. Each time that the directory handles data, the directory queries the schema for an appropriate object definition. Based on the object definition in the schema, the
    directory creates the object and stores the data. 
    Object definitions control the types of data that the objects can store, as well as the syntax of the data. Using this information, the schema ensures that all objects conform to their standard definitions. As a result, Active Directory can store, retrieve,
    and validate the data that it manages, regardless of the application that is the original source of the data. Only data that has an existing object definition in the schema can be stored in the directory. If a new type of data needs to be stored, a new object
    definition for the data must first be created in the schema. 
    You can find more information from below article.
    Active Directory Schema Technical Reference
    http://technet.microsoft.com/en-us/library/cc759402(v=ws.10).aspx
    What's New in Active Directory Domain Services (AD DS)
    http://technet.microsoft.com/en-in/library/hh831477.aspx
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • Add user to Active directory using SAP ABAP

    Hi Experts,
    I am currently working on a security refractor project where we are planning on automating the user creation process in business object and Oracle Hyperion using GRC-BW.
    Our Hyperion user management is based on active directory/LDAP groups.
    So say for example - we have a new user say ABC and in GRC he select the SAP-BW role 'HYP_FINANCE_USA' then I want to write a program in BW which will see who all users are assigned to 'HYP_FINANCE_USA' role and will go an update the active directory distribution list group named 'HYP_FINANCE_USA'.
    Has anyone written a ABAP program or used standard function modules/BADI's etc to add/delete user from active directory/LDAP group ?

    Would you post your code? I have yet to see any working jndi code to add a user to AD. Thanks.

  • Is there a way to authenticate an iPad to our WLAN using a digital certificate and then authorize the user in Active Directory?

    We want to authenticate both a device (iPad) to our corporate WLAN, but after authenticating the device we would also like to authentiate the user in Active Directory if possible.  Has anyone had any experience with this?

    You need to make sure that the server sends the "GeoTrust DV SSL CA" intermediate certificate.
    See:
    * http://www.networking4all.com/en/support/tools/site+check/ (www.ucfs.net)
    * https://knowledge.geotrust.com/support/knowledge-base/index?page=content&id=SO9557
    * https://knowledge.geotrust.com/support/knowledge-base/index?page=content&id=AR1422

Maybe you are looking for

  • When/how do you move files off of Hard Drive to make new room.

    Maybe this is simple; I understand so far that you can choose the Library folder for iTunes and that that is the source of all songs, album cover art, everything that iTunes needs to display all the information for tunes. Please correct me if I am wr

  • RWRBE60.EXE - Application Error. The memory could not be written - URGENT !

    Hi, We are getting the error "RWRBE60.EXE - Application Error. The memory could not be written" in two of the 5 machines. That too, this error is encountered only some times and not always. Scenario: The report builder generates the .PDF file and pla

  • Kernel 2.6.24 and UVesaFB

    I have recently installed fbsplash from the AUR, and would like to use uvesafb, now included in the vanilla kernel. Now I am wondering why I can't get any higher than 640x480. When I try and put in a line with something else, it is just ignored. DonG

  • The application quit unexpectedly

    I've been getting this error message extraordinarily frequently lately. I'll simply be browsing in safari and all of the sudden the program will quit. I'll get the message "the application safari quit unexpectedly. Mac os X and other applications are

  • Nokia E72 symbols/signs on bottom of screen

    Ive went throught the whole user manual to see if they explain what the little symbols mean in the bottom of my screen. I have the E72 now for a month almost and in the beginning there were no symbols/signs in the screen now i have 2. The signs/symbo