Problem adding some user or active directory group to sharepoint 2010 group

Hi All
I have a problem in a specific site collection in a web Application (but not on other site collection in that webApp).
whenever I add a user like some system account to a sharepoint group or create a new sharepoint group or add an ActiveDirectory group to a sharepoint group I get an error and the user / group are not added :
System.Runtime.InteropServices.COMException: [Work Email Address] - [Wrong Email Format]    at Microsoft.SharePoint.Library.SPRequestInternalClass.EnsureUserExists(String bstrUrl, String bstrLogin, String bstrEmail, String bstrName, String
bstrNotes, String bstrMobilePhone, Int32 lFlags, Boolean bIsRole, Boolean bSendEmail, Boolean bForceAdd, Byte[]& ppsaSystemId, Boolean bImportDeleted, Int32& plUserId)     at Microsoft.SharePoint.Library.SPRequest.EnsureUserExists(String
bstrUrl, String bstrLogin, String bstrEmail, String bstrName, String bstrNotes, String bstrMobilePhone, Int32 lFlags, Boolean bIsRole, Boolean bSendEmail, Boolean bForceAdd, Byte[]& ppsaSystemId, Boolean bImportDeleted, Int32& plUserId)
when I add a regular user - all goes well.
10x for any help
Shlomy

Hi Shlomy,
i was thinking, perhaps there is an application that use this checking method on your specific site collection, and perhaps it is using a hard-coded command to request it, but seems it got some issue.
as the other site collections, may not have the issue, so perhaps other site collections don't have this application, and you may check that as lead investigation process.
you may try to capture fiddler tool, it may come in handy on tracing the http requests.
http://fiddler2.com/
usually when i trace the application, i would like to create new site, and add the webpart or application one by one, then i may know which application/webpart that have the issue.
as other regular user may not have the issue, perhaps its because system account is by design to not have an email address properties, so when the application/webpart request for it, it become failure.
Regards,
Aries
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

Similar Messages

  • 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.

  • 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 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.

  • 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);

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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.

  • Excluding some computers from Active Directory System Discovery

    Hi,
    I am trying to exclude some computers from Active Directory System Discovery. I created a new Organizational Unit for those excluded computers and that OU is NOT under the OU that I am discovering  in the OU hierarchy. I specified the location
    to be discovered under the Active Directory System Discovery properties. However, it is still discovering the computers that I wanna exclude from the discovery.  I deleted those computers from console manually and run the discovery again, it still
    discovers them.
    What I might be doing wrong?
    Thanks
    Yavuz Selim Atmaca

    Hi,
    If you check under properties on the object, you can see which discovery agent is discovering the reasource, it could be the Group Discovery as well. That is where I would start to troubleshoot it.
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • 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

  • Added a content database from Company A's SharePoint 2010 farm to ours

    I have added a content database from a company (Company A) that we are acquiring. The sent it my SFTP, we downloaded it, added it to the sql db, and I added it as a content database to a SharePoint 2010 farm  at our company (Company B) that is built
    to the exact build that Company A's farm was built to.
    Presently, the database resides in our Development Environment which is a single server that interacts with SQL, which resides on a different server.
    If I copy the URL for the site collections from the Company A's DB (from the site collection list), the content renders perfectly, but  when I attached the database to a Web application that was tied to a host header with an IP address on the DNS Server
    here, at company B, the content doesn't render at all. The only thing that happens is that I am asked to enter my credentials. None of the farm credentials or my credentials (all domain users) work.
    I have made myself via the farm administration password the owner of the site content, but I must be missing something, because I get this error from the page when I try to render it:
    <b>Error message 401.2.: </b> Unauthorized; Logon failed due to server configuration. &nbsp; Verify that you have permission to view this directory or page based on the credentials you supplied and the authenticatio methods enabled
    on the web server.
    I am wondering if this has something to do with the origin of the content, due to the fact that it was created on a different farm under completely different credentials and what I have to do to get it to work outside of the server as content
    under a new Web app.

    Hi,
    Do you have any update?
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Problem authenticating user in Active Directory cross domain

    Hi,
    We have two different AD servers serving our London and Tokyo networks. My application runs in London network but used by both London and Tokyo users.
    The two ADs have domain trust setup between them. I have groups defined in London AD to which users from both the London and Tokyo ADs are assigned.
    'm trying to connect to London AD using the "users credentials" and retrieve the groups they are assigned to.
    I can connect to the London AD using any of the London user and I could retrieve the groups. But when I use a Tokyo user credentials to connect using the London AD server 'm getting Security exception with a code indicating "User Not Found".
    The code I use which is very basic is given below . The code below run as such gives me the following error,
    [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece.
    If I change in the code below, Provider URL to Tokyo AD Server URL then it works but I can't use that due to security restrictions. As per the Windows Team the domain trust should allow me to connect/bind to the London AD Server with the Tokyo credentials.
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "london ldap server url"); 
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.REFERRAL, "follow");
    env.put(Context.SECURITY_PRINCIPAL, "[email protected]"); 
    env.put(Context.SECURITY_CREDENTIALS, "password"); 
    env.put(LdapContext.CONTROL_FACTORIES, "com.sun.jndi.ldap.ControlFactory");
    ctx = new InitialLdapContext(env, null);
    I would like to know how to authenticate a user in a cross domain Active Directory environment. I read in one of the blogs that the "simple bind" will not work for cross domain user authentication. Unfortunately the blogger didn't mention what would work :( . Any help is much appreciated.
    Please bear with me if my query is a naive one and point me in the right direction.
    Thanks
    Jothi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Praveen,
    to avoid losing data when user objects are moved to new locations in the LDAP server, it is possible to configure the User Management Engine to use the value of a specific unique attribute as part of the unique ID instead of the distinguished name.
    For this, you have to change the following UME properties:
    For user objects: ume.ldap.unique_user_attribute=<attributename>
    For account objects: ume.ldap.unique_uacc_attribute=<attributename>
    For group objects: ume.ldap.unique_grup_attribute=<attributename>
    Be aware that the attribute (i.e. cn or uid) must be unique in the configured user/group path.
    Please read SAPNote 777640 for more information regarding this problem and the way to change the UME properties.
    Best regards,
    Robert

  • How to get Primary Group details of a user from Active Directory

    Hi ,
    This is Viswanath. I want to know how can we retrieve the primary group of a user (Active Directory). I have searhed the entire forum but could not get the required information.
    The reference link is which i have searched is : http://forum.java.sun.com/thread.jspa?threadID=581444
    I got a sample .NET project where we can retrieve the primary group information :
    refer to the link : http://dunnry.com/blog/DeterminingYourPrimaryGroupInActiveDirectoryUsingNET.aspx
    you can download the sample project and build that in VS.NET 2003 and see the result. Please let me know if this kind of implementation is possible in java.
    Kindly help me as i have to provide a solution to my client.
    Regards,
    Viswanath.
    Edited by: sriganesh on Jun 22, 2008 10:36 AM
    can anybody please share their thoughts on the above

    To connect to the Active Directory you can do something like this:
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import javax.naming.directory.DirContext;
    import javax.naming.directory.InitialDirContext;
    public class AD
    public static void main(String[] args)
    Hashtable environment = new Hashtable();
    //Just change your user here
    String myUser = "myUser";
    //Just change your user password here
    String myPassword = "myUser";
    //Just change your domain name here
    String myDomain = "myDomain";
    //Host name or IP
    String myActiveDirectoryServer = "192.168.0.20";
    environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    environment.put(Context.PROVIDER_URL, "ldap://" + myActiveDirectoryServer + ":389");
    environment.put(Context.SECURITY_AUTHENTICATION, "simple");
    environment.put(Context.SECURITY_PRINCIPAL, "CN=" + myUser + ",CN=Users,DC=" + myDomain + ",DC=COM");
    environment.put(Context.SECURITY_CREDENTIALS, myPassword);
    try
    DirContext context = new InitialDirContext(environment);
    System.out.println("Exit!!");
    catch (NamingException e)
    e.printStackTrace();
    Reddy Pathepuram
    Inteligic Inc

  • Adding a listener to Active directory for user creation using Java

    Hi,
    I would like to add a listener to active directory such that when a user is created to the "Users" container, I should be notified or informed. I would like to do this with Java. What should I do ?
    Regards,
    Anand Kumar D

    You should add a NamingListener or a NamespaceChangedListener.

  • 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?

Maybe you are looking for

  • Fibre not the speed it was sold as

    Got Fibre unlimited in on the 15th june, since day 1, slow and unstable. My access line speed is 32mbps but my stats are: Broadband LinkDownstreamUpstreamConnection Speed9733 kbps1245 kbpsLine Attenuation34.4 dB0.0 dBNoise Margin7.9 dB6.6 dB  Had mul

  • IPod Touch Stopped Working after erasing all content and settings

    I have a 32GB Touch I bought in January from Amazon. I just got the new iPhone and was planning selling the Touch. I used the "Erase all content and settings" and, since then, the iPod Touch does not respond. I let it sit over night since the manual

  • Please help me. ipod not registering

    Hi My ipod charger broke so I havnt used my ipod for a while. When I pluged in my ipod to my computor it said that it was corrupt and needed to be restored. So I tried that and my computor crashed. Now when I plug it the do not disconect thingy comes

  • IOS 5.1 beta 3

    I tried to install iOS beta 3 on my iphone 4s but i wasn't able to activate it, so I entered into recovery mode and then restored, what can I do to run iOS 5.1 or at least to have the possibility to switch off 3G network without switching off Network

  • App-store locks to one of several users even though app to be updated is a system app

    The app-store locks to one of several users even though app to be updated is a system app avalable to all users. That is to say that the signin user name text box is auto entrered and grayed so it can't be changed. I assume that the last user to upda