How to create User in the specific group in Microsoft Active Directory

Hi,
I am using Nestcape LDAP, and want to create user in the user defined group. I have created a new user group "TestUsers" in the "Users" container of Active Directory, I want to add the new user to Test Users group But my problem is that whenever I create a new user
it get added to Domain Users group.
I tried adding memberOf attribute with value "TestUsers"
attr = new LDAPAttribute("memberOf", "TestUsers");          
attrs.add(attr);
It gives me following error :
code= 53 Exception 0000209A: SvcErr: DSID-031A0D6F, problem 5003 (WILL_NOT_PERFORM), data 0
Following is the code I am using.
public LDAPResult createUserID(
String userId,
String pwd,
String pId,
boolean resetonLogOn,
LDAPConnection ldCon) {
boolean flag = false;
int code=0;
try {
String pwdLastSetVal;
String desName;
String desc;
/* Specify the DN of the new entry. */
String dn =
"CN=" + userId + ",CN=" + this.container + "," + this.baseDN; // container = "Users"
/* Create and add attributes to the attribute set. */
String objectclass_values[] =
{ "top", "person", "organizationalPerson", "user" };
// LDAPEntry findEntry=null;
/* Create a new attribute set for the entry. */
LDAPAttributeSet attrs = new LDAPAttributeSet();
/* Attribute sAMAccountName */
LDAPAttribute attr = new LDAPAttribute(LDAP_SAM_KEY, userId);
attrs.add(attr);
/* Attribute unicodePwd */ // LDAP_PASSWORD_KEY = "unicodePwd"
attr =
new LDAPAttribute(
LDAP_PASSWORD_KEY,
(byte[]) this.encodePassword(pwd));
attrs.add(attr);
/* Attribute Display Name */
desName = userId + ":" + pId;
//desName = userId ;
attr = new LDAPAttribute(LDAP_DIS_NAME_KEY, desName);
attrs.add(attr);
/** Attribute userAccountControl to enable the userid.
attr = new LDAPAttribute(LDAP_ACCOUNT_KEY, LDAP_ACCOUNT_EN_VAL); // LDAP_ACCOUNT_EN_VAL= "548"
attrs.add(attr);
/* Attribute pwdLastSet to reset the password on first logon*/
if (resetonLogOn == true) {
pwdLastSetVal = "0";
} else {
pwdLastSetVal = "-1";
attr = new LDAPAttribute(LDAP_RESET_KEY, pwdLastSetVal);
attrs.add(attr);
/* Attribute Description */
desc = " Account Created by HelpNow App";
attr = new LDAPAttribute(LDAP_DESC_KEY, desc);
attrs.add(attr);
/* Attribute objectclass */
attr = new LDAPAttribute("objectclass", objectclass_values);
attrs.add(attr);
attr = new LDAPAttribute("memberOf", "TestUsers");          
attrs.add(attr);
/* Create an entry with this DN and these attributes . */
LDAPEntry myEntry = new LDAPEntry(dn, attrs);
/* Add the entry to the directory. */
ldCon.add(myEntry);
flag = true;
}catch (LDAPException e) {
flag = false;
code=e.getLDAPResultCode();
}catch (Exception e) {
flag = false;
code=LDAPException.OTHER;
}finally {
ldaprs.flag=flag;
ldaprs.code=code;
return ldaprs;
}

Refer to the post titled "JNDI, Active Directory and Group Memberships" available at http://forum.java.sun.com/thread.jspa?threadID=581444&tstart=150

Similar Messages

  • The user and the mailbox are in different Active Directory Sites

    Hi All,
    I have 2 site, each site have an Exchange Server 2010 SP1, let say Site HQ and Site DRC I monitored it with SCOM 2007 R2, site HQ successfully monitored, then I continue try to monitor DRC site. I executed new-TestCasConnectivityUser.ps1 at MBX DRC Site
    to create extest user.
    Then I try to execute command to test-connectivity, but it failed.
    Test-OwaConnectivity -TestType:Internal -MonitoringContext:$true -TrustAnySSLCertificate:$true -LightMode:$true | fl
    RunspaceId                  : 6b709fa5-0719-4be5-ae62-ec4b3617a6e0
    AuthenticationMethod        :
    MailboxServer               : CONMBX02.contoso.com
    LocalSite                   : CONMBX02.contoso.com
    SecureAccess                : False
    VirtualDirectoryName        :
    Url                         :
    UrlType                     : Unknown
    Port                        : 0
    ConnectionType              : Plaintext
    ClientAccessServerShortName : DRCCAS01
    LocalSiteShortName          : CONMBX02
    ClientAccessServer          : DRCCAS01.contoso.com
    Scenario                    : Reset Credentials
    ScenarioDescription         : Reset automated credentials for the Client Access Probing Task user on Mailbox server CON
                                  MBX02.contoso.com.
    PerformanceCounterName      :
    Result                      : Failure
    Error                       : [Microsoft.Exchange.Monitoring.CasHealthStorageErrorException]: An error occurred while t
                                  rying to access mailbox CONMBX02.contoso.com, on behalf of user contoso.com\extes
                                  t_xxxxxxxx
                                   Additional information:
                                   [Microsoft.Exchange.Data.Storage.WrongServerException]: The user and the mailbox are in
                                  different Active Directory sites..
    UserName                    : extest_xxxxxxxx
    StartTime                   : 04/01/2012 20:46:19
    LaCONcy                     : 00:00:00.0156460
    EventType                   : Error
    LaCONcyInMillisecondsString :
    Identity                    :
    IsValid                     : True
    WARNING: No Client Access servers were tested.
    RunspaceId          : 6b709fa5-0719-4be5-ae62-ec4b3617a6e0
    Events              : {Source: MSExchange Monitoring OWAConnectivity Internal
                          Id: 1005
                          Type: Error
                          Message: Couldn't access one or more test mailboxes.
                          The service that is being tested will not run against these mailboxes.
                           Detailed information:
                          Local Site:DRCProduction
                          [Microsoft.Exchange.Monitoring.CasHealthStorageErrorException]: An error occurred while trying to
                           access mailbox CONMBX02.contoso.com, on behalf of user contoso.com\extest_xxxxxxxx
                           Additional information:
                           [Microsoft.Exchange.Data.Storage.WrongServerException]: The user and the mailbox are in differen
                          t Active Directory sites..
    PerformanceCounters : {Object: MSExchange Monitoring OWAConnectivity Internal
                          Counter: Logon LaCONcy
                          Instance: DRCCAS01.contoso.com|DRCProduction
                          Value: -1000}
    any help appreciate it.
    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.
    Krisna Ismayanto | My blogs:
    Krisna Ismayanto | Twitter: @ikrisna

    Hi
       Removed existing test account on two site.
       Then created test account on DGC through new-TestCasConnectivityUser.ps1.
       Flushed Health Service on RMS.
    Terence Yu
    TechNet Community Support
    Hi
    What do you mean on DGC ? you mean I have remove both test account or just at DRC site only ?
    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.
    Krisna Ismayanto | My blogs:
    Krisna Ismayanto | Twitter: @ikrisna

  • Test-OutlookConnectivity fails with '[Microsoft.Exchange.Data.Storage.WrongServerException]: The user and the mailbox are in different Active Directory sites'.

    I have a two site DAG, and the command is running from the alternate site where the databases are not currently being hosted. The following command...
    Test-OutlookConnectivity -Protocol:TCP -TrustAnySSLCert:$true -MonitoringContext:$true
    ...errors with the following output:
    An error occurred while trying to access mailbox CurrentlyHostingMBServerName.InternalDomainName, on behalf of user InternalDomainName\extest_bb13200232474
     Additional information:
     [Microsoft.Exchange.Data.Storage.WrongServerException]: The user and the mailbox are in different Active Directory sit
    es..
        + CategoryInfo          : OperationStopped: (Microsoft.Excha...onnectivityTask:TestOutlookConnectivityTask) [Test-
       OutlookConnectivity], CasHealthStorageErrorException
        + FullyQualifiedErrorId : F2F8AC0D,Microsoft.Exchange.Monitoring.TestOutlookConnectivityTask
    I thought this command would work based on the 'AllowCrossSiteRpcClientAccess: True' option on the DAG.  The command works well if run a CAS server in the active DB site.

    Hi,
    Exchange 2013 users use Outlook Anywhere to connect to CAS server. You may run the RCA to test the connectivity:
    https://www.testexchangeconnectivity.com/
    Thanks,
    Simon Wu
    TechNet Community Support

  • How to create user in specific user group in Microsoft Active Directory ?

    Hi,
    I am using Nestcape LDAP, and want to create user in the user defined group. I have created a new user group "TestUsers" in the "Users" container of Active Directory, I want to add the new user to Test Users group But my problem is that whenever I create a new user
    it get added to Domain Users group.
    Following is the code I am using which adds user to default group Domain Users.
    public LDAPResult createUserID(
    String userId,
    String pwd,
    String pId,
    boolean resetonLogOn,
    LDAPConnection ldCon) {
    boolean flag = false;
    int code=0;
    try {
    String pwdLastSetVal;
    String desName;
    String desc;
    /* Specify the DN of the new entry. */
    String dn =
    "CN=" + userId + ",CN=" + this.container + "," + this.baseDN; // container = "Users"
    /* Create and add attributes to the attribute set. */
    String objectclass_values[] =
    { "top", "person", "organizationalPerson", "user" };
    // LDAPEntry findEntry=null;
    /* Create a new attribute set for the entry. */
    LDAPAttributeSet attrs = new LDAPAttributeSet();
    /* Attribute sAMAccountName */
    LDAPAttribute attr = new LDAPAttribute(LDAP_SAM_KEY, userId);
    attrs.add(attr);
    /* Attribute unicodePwd */ // LDAP_PASSWORD_KEY = "unicodePwd"
    attr =
    new LDAPAttribute(
    LDAP_PASSWORD_KEY,
    (byte[]) this.encodePassword(pwd));
    attrs.add(attr);
    /* Attribute Display Name */
    desName = userId + ":" + pId;
    //desName = userId ;
    attr = new LDAPAttribute(LDAP_DIS_NAME_KEY, desName);
    attrs.add(attr);
    /** Attribute userAccountControl to enable the userid.
    attr = new LDAPAttribute(LDAP_ACCOUNT_KEY, LDAP_ACCOUNT_EN_VAL); // LDAP_ACCOUNT_EN_VAL= "548"
    attrs.add(attr);
    /* Attribute pwdLastSet to reset the password on first logon*/
    if (resetonLogOn == true) {
    pwdLastSetVal = "0";
    } else {
    pwdLastSetVal = "-1";
    attr = new LDAPAttribute(LDAP_RESET_KEY, pwdLastSetVal);
    attrs.add(attr);
    /* Attribute Description */
    desc = " Account Created by HelpNow App";
    attr = new LDAPAttribute(LDAP_DESC_KEY, desc);
    attrs.add(attr);
    /* Attribute objectclass */
    attr = new LDAPAttribute("objectclass", objectclass_values);
    attrs.add(attr);
    /* Create an entry with this DN and these attributes . */
    LDAPEntry myEntry = new LDAPEntry(dn, attrs);
    /* Add the entry to the directory. */
    ldCon.add(myEntry);
    flag = true;
    }catch (LDAPException e) {
    flag = false;
    code=e.getLDAPResultCode();
    }catch (Exception e) {
    flag = false;
    code=LDAPException.OTHER;
    }finally {
    ldaprs.flag=flag;
    ldaprs.code=code;
    return ldaprs;
    }

    Refer to the post titled "JNDI, Active Directory and Group Memberships" available at http://forum.java.sun.com/thread.jspa?threadID=581444&tstart=150

  • When provision to Active Directory, how to create user in a specific OU????

    Hi all,
    I have installed Oracle AD Connector 9.1.
    When I try to provision a user to AD, the user is creating in the Users ou.
    1) How can I create a user inside a specific ou.(other than Users ou)?
    2) How can I add users to AD Groups?
    I have tried to solve this problem by reading the Oracle Connector Documentation. And I already done it for 3 times.(all the steps in that documentation). But, couldn't find any way to solve these problems.
    Also, I tried to read other forums. But, can not solve the problem.
    Please help me.
    Thank you.
    Chaturanga

    Hi,
    Just see the process form.You will see a field name organization.You need to pre- populate this fields as per your logic.Let me know if you have any clarifications.
    Regards
    Nitesh

  • Change All User Settings in Specific OU(s) In Active Directory 2008

    I want to Change the Password of All the Users in Some OUs in active Directory 2008.
    And Also i want to Change the Attributes of all users in specific OU(s).
    What is Procedure?
    Note:- My OUs names are in Arabic Language, I feel some errors whenever i user commands in Power Shell.
    Thanks

    Hello Genius
    In addition to other expert advice about bulk modify I have to add that although my first language is not English, I personally prefer to name my OU's in English language. I experienced some problems with non-English OU's especially when it comes to reporting
    with Powershell.
    Regards.
    Mahdi Tehrani Loves Powershell
    Please Do not hesitate to click on Vote As Helpfull
    if a post helps you or Mark As Answer
    if a post answers your question.
    @Mahdi,
    PowerShell Integrated Scripting Environment (ISE) 3.0
    supports Unicode Language (Arabic, Farsi/Persian, etc.), you do not have problem with non-english. Here is example:
    New-ADUser –sAMAccountName „شنگولی“ –UserPrincipalName شنگولی@contoso.com –givenname “شنگولی” –Surname “شنگول” –displayName “شنگولی شنگول” –Name “شنگولی شنگول” –Enabled $true –Path “OU=MSFT,DC=Contoso,DC=com” –AccountPassword (ConvertTo-Securestring “Password01” –asplaintext –Force)
    More Information:
    Windows PowerShell 3.0 Integrated Scripting Environment (ISE)
    Regards

  • Create users via the CLI interface on a SX20

    Hi 
    Are there some who know how to create users via the CLI interface on a SX20. You can do this via the web interface but I have many video installations where I need to create a user account. Therefore, it would be easiest if I can make it through the CLI interface. 
    Best regards 
    Jesper

    Unless there's a very well hidden command somewhere, then no. As far as I know, this can only be done for the remote supportuser account;
    xcommand UserManagement ?
    xCommand UserManagement RemoteSupportUser Create
        ExpiryDays: <1..31>
    xCommand UserManagement RemoteSupportUser Delete
    xCommand UserManagement RemoteSupportUser DisablePermanently
        Confirm(r): <Yes>
    xCommand UserManagement RemoteSupportUser GetState
    /jens
    Please rate replies and mark question(s) as "answered" if applicable.

  • How to create user groups in SAP

    Hello Gurus,
    Can anyone let me know how to create user groups in SAP-HR Module and who will be creating  the user groups.
    plz provide me the steps.

    Hi Stephanie,
    IMG --> Personnel Mgmt --> Personnel Administration --> Basic Setting s --> Maintain User Parameters
    Please refer the below links:
    http://scn.sap.com/thread/1653026
    http://scn.sap.com/thread/1682721
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10eab7af-0e54-2c10-28a5-87b47adbe1a5?QuickLink=index&overridelayout=true&44478681629499
    Thanks,
    Madhav.

  • How to create users ,groups and  workflow in batch?

    I have to create 100 groups for each course,and each course has a admin user.Each group has some workflows .These workflow can only be viewed by some users.
    Can i import user name and password from a .txt file and do the work automatically?
    It is a hard work if i do it manually.

    I'm not sure you want to import users to use the magic triangle properly. I think importing creates 'Augmented Records' - the user icons have blue dots.
    The principle is this…
    Bind the server to Active Directory (AD) & create an Open Directory master (OD). This can be done from Server Admin, in the OD section, via the change button.
    Then you use Workgroup Manager, set the viewing directory (tiny little globe in top left) to use LDAP records on the server - LDAPv3/127.0.0.1. Authenticate (lock on right of toolbar) add a group, then switch to to its Members tab, click + Then change the user list to show the AD records & add the AD users to the OD group. It sounds weird & wrong, but it is how it works.
    You are never modifying the AD records, just assigning a group to the users in OD. It's why the clients need to bind to AD & OD.
    From there you can set the Managed prefs (MCX) for the members of the OD group. It also helps to add a guest computer account to OD to assign computer prefs based on the macs that bind to the server - it's in the File menu when you select the computes list in OD.
    I hope that's clear, not sure I can help with the other tasks, but they tend to fall into place once you have the complex start in place.

  • How to create user group for EIS (Executive Information System) KCBA

    Dear Experts,
    How to create user group for EIS (Executive Information System)
    TCode KCBA
    Regards
    Saurabh

    Hi ,
    Check the below link ,hope it will give some inputs for creating groups.
    http://help.sap.com/saphelp_470/helpdata/en/5c/c1c81c445f11d189f00000e81ddfac/content.htm
    Regards
    udayakumar.k

  • How to create users and groups using WLST Offline with Weblogic 8.1.4

    How to create users and groups using WLST Offline with Weblogic 8.1.4?
    Any ideas?

    Hi this is how i created a user using WLST Offline?
    cd('/Security/' + domainName)
    # Delete the default user name weblogic
    # incase you want to remove the defualt user weblogic
    delete('weblogic','User')
    # Creating a new user defined
    create(userName, 'User')
    # Setting the password of the user you created.
    cd ('/Security/' + domainName + '/User/' + userName)
    cmo.setPassword(password)
    Regards
    Makenzo

  • How to add a user to the wheel group?

    How to add a user to the wheel group in leopard?

    In Leopard, users can be added to system groups using 'dscl'. For example, while logged into an "admin" account, the command below can be entered using "/Applications" > "Utilities" > "Terminal.app" to add a user "username" to the "wheel" group:<pre>
    sudo /usr/bin/dscl . -append /groups/wheel GroupMembership username</pre>
    If you prefer a GUI, "Workgroup Manager.app", included with the Leopard version of the "Server Admin Tools" can be used.
    http://www.apple.com/support/downloads/serveradmintools105.html

  • How to create and see the user interface of helloworld sample??

    hello friends,
    i have deployed the hello world sample
    now i want to know how to create and see the user interface of hello world sample.
    thanks and regards..

    If you go to bpel console host:port/BPELConsole (in a dev install, localhost:9700), click on your process, we will generate, based on the describing wsdl a UI for you ..
    hth clemens

  • Restricting end user to one specific group with anyconnect

    Hello all
    I just started configuring AnyConnect with ASA 5520 that uses Cisco SecureACS to pass radius authentication.  I configured two profiles with different split tunnel restrictions and what I discovered is that when the client connects to the ASA, they are provided a choice of these two groups (I guess there is no way to restrict this) and I can log into either one with any user account.  How do I restrict this so that the user can only use one profile?  Currently users capable of VPN would be placed in one specifc AD group so that is what SecureACS checks.  Is there a sample configuration guide to handle multiple profiles with different levels of access?

    Alternatively, you can use Radius authorization to place user into a specific group-policy:
    - Configure the Group-Policy attribute under Radius to be OU=
    http://www.cisco.com/en/US/docs/security/asa/asa91/configuration/vpn/vpn_extserver.html#wp1605475
    On  the ASA, just configure 1 tunnel-group, and depending on the  authentication, the user will be placed into the correct group-policy  specified under the ACS server.

  • How to create users on JDI

    Hi
    How to create users on JDI... how to access JDI....
    I want to create users, groups in JDI
    Please help me....
    Thanks & Regards
    Ravi Shankar B

    Hi
    What is the difference b/w Inactive, active and Local DCs...
    In inactive and active DCs i am not getting any thing... why?
    and i need to know how to do the following configuration.....
    Creating Users
    The following shows you how to create various users. Developer and Admin are just placeholders for actual people. CMSadm, on the other hand, is the user name recommended by SAP for the CMS user used by the CMS to access the DTR, CBS, and SLD.
    .1Choose Create User.
    .2Create the users Developer, Admin, and CMSadm, in this order.
    Assigning Users to Groups
    .1 Choose Groups.
    The Groups screen appears.
    .2 In the Groups field, select the JDI.Developers role and choose Assign Users to ...
    The Assign User(s) screen appears.
    For more information, see the installation manual of SAP NetWeaver Development Infrastructure.
    .3 Choose Add User ...
    The Search for User screen appears.
    .4 Enter the user ID Developer and choose Search.
    The Search Result(s) screen appears.
    .5 In the list, select the Developer user and choose Select.
    On the Assign User(s) screen, you see a list of all users that have the JDI.Developers role. Developer has now also been included in the list.
    .6 In the same way, assign the JDI.Administrators role to the users Admin and CMSadm.
    If the SLD is installed on a separate J2EE Engine, you must also create the users Developer and CMSadm in this Engine as well.
    Thanks & Reagards
    Ravi Shankar B
    Message was edited by: RaviShankar B

Maybe you are looking for

  • Palm Desktop

    I am having two problems that I can't seem to solve w/ Palm desktop. First, I have the problem that when I view month mode in calendar my program quits.  Not every month.  Just some.  I looked on this web site and after that I made sure no appointmen

  • How do I open the door to my Optical Network Terminal (ONT) to replace the backup battery

    I have an ONT that looks like this: http://www.verizon.com/cs/groups/public/documents/adacct/bbux400-open.jpg How do I open the door to it to replace the battery? Thanks Ben Solved! Go to Solution.

  • Attached photos are automatically reduced in size - how do I stop this?

    iPad mini using Mail. My wife somehow changed a setting and it doesn't ask what size I want to send the photo as, it just automatically sends it as a reduced file size. I'd like the option to chose each time I send one.

  • Sharing resources between parent FDO and children PDO

    Hello, I 'm developping a WDM driver for a FPGA that embeds several uarts and a CAN controler in one PCI slot. I use the DDK Toaster sample as a basis. Has someone already shared resources between  parent FDO and children PDO ? One way will be to exp

  • Video navigation using  a flash button

    I have a wmv video file, which I want to import into flash. When I click on a button I want to be able to jump to a specific point in the video. Is this possible? Thanks