Add multiple users to AD Group using AddRange

All,
I am trying to add multiple users to an AD security group using AddRange method but no luck.
Reason why I am using AddRange method is, the memberlist is pretty big (30K users) and Quest or MSFT AD Cmdlets taking plenty of time to add them.
I am following the instruction per http://msdn.microsoft.com/en-in/library/ms180904(v=vs.80).aspx but no luck.
Code snippet:
$groupmembers = Get-Content C:\Temp\MemberDN.txt
$getgroup = [ADSI]"LDAP://CN=MYADGROUP,OU=GROUPS,DC=CONTOSO,DC=COM"
$getgroup.properties.member.AddRange($groupmembers)
#$getgroup.properties["member"].AddRange($groupmembers)
$getgroup.CommitChanges()
#$getgroup.SetInfo()
I tried using ADSPATH as well but no luck.
Any help or pointers are appreciated.
Thanks.

Hi PSPR,
I agree with David .
Also I tested that on my server2012r2 , please refer to :
$user="cn=test1,cn=users,dc=test,dc=com","cn=test2,cn=users,dc=test,dc=com"
$obj=[adsi]"LDAP://cn=test,cn=users,dc=test,dc=com"
$obj.member.addrange($user)
$obj.commitchanges()
Hope it helps
Best Regards
Elton Ji
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place.

Similar Messages

  • How to add multiple users to a role in ECC 6.0

    How to add multiple users (say 1000) to a role in ECC 6.0?

    Hi
    You can actually add multiple users to a role using transaction SU01. From SU01, use the menu Environment->Mass Changes.
    Here you can manually add the users, select them by address or authorisation data. Once you have your user list, you can then add or remove roles and/or profiles.
    Secondly , You can use SU10 to do mass changes to multiple users including role assignments per logical systems
    Also check the following link:
    http://www.sap-img.com/bc021.htm
    I hope this should do it
    regards
    Chen

  • Trying to add a user to a Group thru JNDI. Insuffficient Access Rights

    I am trying to add a user to a group using JNDI with,
    DirContext.modifyAttributes()
    I have set up the tree structure outside the default cn=Users setup and defined the Group as auxiliary class.
    I haven't set up any Access Controls. But it fails with "Ldap Error code 50. Insufficient Access Rights".
    If I try to add the same user using the uniquemember attribute to the group I am interested in, it works fine in Directory Manager and Generic Ldap browser. I even tried setting up the JNDI user credentials to "orcladmin" still doesn't work. Any idea??

    Maybe the example code from OID developers guide gives an idea
    http://download-west.oracle.com/docs/cd/A97329_03/manage.902/a95193/smplcode.htm#637267
    --Olaf                                                                                                                                                                                                                                                                                                                                       

  • Add user to sharepoint group using REST API

    I am trying to add a user to sharepoint group with following code
    serviceUrl= Appweb + "/_api/SP.AppContextSite(@target)/web/sitegroups("+GroupId+")/users?@target='host web'";
        $.ajax({
            url: serviceUrl,
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataType: 'json',
            body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|'+email }",
      headers: {"accept":"application/json;odata=verbose",
        "content-type": "application/json;odata=verbose",
        "X-RequestDigest":$("#__REQUESTDIGEST").val()
        async: false,
      success: function (data) {
               alert('success');
      error: function (data) {
                 alert('fail');
    The request goes to error function. Response of the request is Microsoft.SharePoint.Client.InvalidClientQueryException and message is A node of type 'EndOfInput' was read from the JSON reader when trying to read the start of an entry. A 'StartObject' node was
    expected
    I tried the sample from following link but fail it
    https://msdn.microsoft.com/en-us/library/office/dn531432.aspx

    Hi,
    Per my understanding, you might want to add an user to a SharePoint group in host web from a SharePoint Hosted App using REST API.
    Here is a working demo for your reference:
    var hostweburl;
    var appweburl;
    $(document).ready(function () {
    //Get the URI decoded URLs.
    hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
    appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
    // Resources are in URLs in the form:
    // web_url/_layouts/15/resource
    var scriptbase = hostweburl + "/_layouts/15/";
    // SP.RequestExecutor.js to make cross-domain requests
    $.getScript(scriptbase + "SP.RequestExecutor.js", loadPage);
    // Utilities
    // Retrieve a query string value.
    // For production purposes you may want to use a library to handle the query string.
    function getQueryStringParameter(paramToRetrieve)
    var params = document.URL.split("?")[1].split("&");
    for (var i = 0; i < params.length; i = i + 1)
    var singleParam = params[i].split("=");
    if (singleParam[0] == paramToRetrieve) return singleParam[1];
    function addUsersInGroup() {
    var executor;
    // Initialize the RequestExecutor with the app web URL.
    executor = new SP.RequestExecutor(appweburl);
    executor.executeAsync({
    url: appweburl + "/_api/SP.AppContextSite(@target)/web/sitegroups(8)/users?@target='" + hostweburl + "'",
    method: "POST",
    contentType: "application/json; charset=utf-8",
    dataType: 'json',
    body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|[email protected]'}",
    headers: {
    "Accept": "application/json; odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-RequestDigest":$("#__REQUESTDIGEST").val()
    success: addUsersInGroupSuccessHandler,
    error: addUsersInGroupErrorHandler
    function addUsersInGroupSuccessHandler(data)
    console.log(data);
    var jsonObject = JSON.parse(data.body);
    console.log(jsonObject);
    function addUsersInGroupErrorHandler(data)
    console.log(data);
    var jsonObject = JSON.parse(data.body);
    console.log(jsonObject);
    Thanks 
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected].

  • How do you add multiple users to an itunes account

    how do you add multiple users to an itunes account

    First :
    Using an iPhone without a wireless service plan
    Then restore the iPod to factory settings/new iPod on the computer your kids will use:
    iTunes: Restoring iOS software
    If you are using the same computer
    How to use multiple iPods, iPads, or iPhones with one computer

  • How to Add multiple entry to the group policy security filtering

    How to Add multiple entry to the group policy security filtering
    Is there any way we can add multiple entry to the Domain group policy Security filtering tab.Currently its not allowing to add more then one entry at a time.
    Getting Error like "only one name can be entered,and the name cannot contain a semicolon.Enter a valid name"

    Hi
    Are you trying to add more users or groups through Group Policy Management Security Filtering tab?
    Try right clicking on the policy and then edit
    Then in Editor Right click on the name of the policy and Properties
    Security tab and add user or group from this tab. Just make sure if you are adding user or groups "Select this object type" has
    the correct option also "From this Location" is set to your entire directory not the local server.
    Update us with the above.
    Thanks

  • Add multiple users to a certain database in the SQL server in one go

    I wonder if there is any method to add multiple users to a certain database in the SQL server in one go and without using transact code.
    I can add a single user to a certain database “Q” for example by right click on the user “U1” for example then properties then in user mapping tab select
    the database “Q”, so there should be a method to add multiple users ( U1,U2,U3…) to this database?
    Best Regards,
    Ahmad

    Many thanks Visakh16,
    I can do this using the below script, but what I am searching for is do to this without any scripting.
    USE TestDatabase; --Make sure you have the right database
    DECLARE @sql VARCHAR(MAX) = '';
    SELECT @sql = @sql + 'CREATE USER ' + name + ' FOR LOGIN ' + name + ';
    ' +
    'GRANT CREATE TABLE, CREATE PROCEDURE, CREATE VIEW, VIEW DEFINITION TO ' + name + ';
    FROM sys.server_principals p
    WHERE p.type in ('S','U') -- SQL Logins and Windows Login. Do not change!
    and p.name in ('U1','U2','U3'); -- List of names to add. alter to suit
    PRINT @sql; -- Show the statements being executed in the messages pane
    EXEC(@sql); -- Run the statements that have been built
    Thanks,
    Ahmad

  • Regarding : How to add a user to portal group with the help of webdynpro .

    Hii ,
    I am working on an application in which with the help of an action( Button)  we r adding a user in Ztable in R/3 , as well as  group in portal.
    The user r successfully creating in Ztable but from portal side No user is assigned to Portal group.
    I need coding solution for " How to add a user to portal group with help of webdynpro"
    Any usefull link will also do.
    Pls anyone have any solution ??
    Thnks in advance.
    Rewards r waiting for u .

    Hi,
    Use UME api to add user to portal group.
    Using UME API:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40d562b7-1405-2a10-dfa3-b03148a9bd19
    Regards,
    Naga

  • Creating Multiple Users in AS Portal using PL/SQL

    Hi Guys,
    I am very new to Portal and I was wondering if there was a way to add multiple users to Portal using a PL/SQL API?
    I have found an API called wwsec_api which has a function add_portal_users but this doesnt seem to work when I try to add a user.
    Any help is much appreciated
    Thanks
    -Mark

    The users are created in OiD, not in Oracle Portal. Oracle Portal just uses OiD similar to other products.
    The following note on http://support.oracle.com provides information about creation of users in OiD both through PL/SQL and Java :
    Note 277771.1 - How to create a new user in OID using the programmatic interfaces
    For Portal, is is important that the users are created below the user search base configured in your Portal application. This is normally something like cn=Users,dc=<your domain>, e.g. cn=Users,dc=acme,dc=org.
    Hope this helps,
    EJ

  • How do I add multiple contacts to a group?

    How do I add multiple contacts to a group on my Ipad?

    See if this thread helps.
    https://discussions.apple.com/thread/4114588
    Matt

  • Add grid user to dba group

    Hello,
    After RAC installation, We are facing some cluster issues. After investigation, Oracle support suggested to add the grid user to the dba group. We missed to add the grid user to the dba user in most of the nodes. This is Linux Redhat 5.
    How can I add grid user to dba group and keep the grid user belonging to the other linux groups? what 's the correct command?
    Thanks,
    Diego

    Hi,
    As root:
    #### check before
    id  grid
    #### Change It
    usermod -a -G dba grid
    #### Check after
    id gridLevi Pereira

  • HT3965 Can you add multiple user profile to the iPad

    Can you add multiple user profile to the iPad

    Hi Friend,
    Apple devices are developed for single users.
    Hope it helps

  • Wlst add a user to a group

    Hi,
    I have problems with wlst to add a user to a group
    The method "addMemberToGroup" of the security MBean DefaultAuthenticator doesn't seem to be accessible from wlst.
    Here's the part of the code (note that the group and user already exist, i am sure of it)
    myusername="BIGREZADMIN"
    group="BigRezAdministrators"
    cd("/")
    cd("weblogic.security.providers.authentication.DefaultAuthenticator/Security:Name=myrealmDefaultAuthenticator")
    try:
    cmo.addMemberToGroup(group,myusername)
    except Exception:
    dumpStack()
    And what I get:
    AttributeError: addMemberToGroup
    Also tried like this:
    cd("weblogic.security.providers.authentication.DefaultAuthenticator/Security:Name=myrealmDefaultAuthenticator")
    objs =jarray.array([group,myusername],java.lang.Object)
    strs =jarray.array(["java.lang.String","java.lang.String"],java.lang.String)
    try:
    invoke('addMemberToGroup',objs,strs)
    except WLSTException:
    dumpStack()
    and here's what I get:
    [java] weblogic.management.ManagementRuntimeException: javax.management.OperationsException: no such operation: addMemberToGroup
    I have also tried inverting attributes of the addMemberToGroup without success. The createUser("user","password","desc") and createGroup("group","desc") work fine but I don't manage
    to add a user to a group with WLST.
    Am I doing it the wrong way?
    Thanks,
    Luc

    Hello Luc,
    I am able to easily add a user to a group w/o a problem. I did this,
    connect("weblogic","weblogic")
    cd("SecurityConfiguration/mydomain")
    cd("weblogic.security.providers.authentication.DefaultAuthenticator/Security:Name=myrealmDefaultAuthenticator")
    cmo.createUser("foo","weblogic","foo-1")
    cmo.createGroup("mygroup","hello")
    cmo.addMemberToGroup("mygroup","foo")
    Thats it, did not get any exception. Try printing the cmo to see if the
    cmo is currectly populated.
    Thanks,
    -satya
    Luc Dewavrin wrote:
    Hi,
    I have problems with wlst to add a user to a group
    The method "addMemberToGroup" of the security MBean DefaultAuthenticator doesn't seem to be accessible from wlst.
    Here's the part of the code (note that the group and user already exist, i am sure of it)
    myusername="BIGREZADMIN"
    group="BigRezAdministrators"
    cd("/")
    cd("weblogic.security.providers.authentication.DefaultAuthenticator/Security:Name=myrealmDefaultAuthenticator")
    try:
    cmo.addMemberToGroup(group,myusername)
    except Exception:
    dumpStack()
    And what I get:
    AttributeError: addMemberToGroup
    Also tried like this:
    cd("weblogic.security.providers.authentication.DefaultAuthenticator/Security:Name=myrealmDefaultAuthenticator")
    objs =jarray.array([group,myusername],java.lang.Object)
    strs =jarray.array(["java.lang.String","java.lang.String"],java.lang.String)
    try:
    invoke('addMemberToGroup',objs,strs)
    except WLSTException:
    dumpStack()
    and here's what I get:
    [java] weblogic.management.ManagementRuntimeException: javax.management.OperationsException: no such operation: addMemberToGroup
    I have also tried inverting attributes of the addMemberToGroup without success. The createUser("user","password","desc") and createGroup("group","desc") work fine but I don't manage
    to add a user to a group with WLST.
    Am I doing it the wrong way?
    Thanks,
    Luc

  • Urgent Help needed! ADSI can't add local user to local group when there are variables

    Hi friends
    it about 8 hours i am working on following simple code but no result. i feel i am loosing my eyes
    i need to use a code within my PS script to add a Local user to the built-in "Users" Local Group in windows 7 , 8, 2012....
    the following code which the username is not related with any variable works fine.
    $computer = [ADSI]"WinNT://."
    $user = $computer.Create("User","MyLocaluser")
    $user.setinfo()
    $user.SetPassword("P@ssw0rd")
    $Group = [ADSI]"WinNT://./Users,Group"
    $Group.Add("WinNT://MyLocaluser,user")
    but in the 2 following scenarios (which Variables enter into codes), doesn't work: (for simplicity & be easier to read, i have bolded the only differences in my 3 scenarios for you
    Scenario1:
    $computer = [ADSI]"WinNT://."
    $user = $computer.Create("User","MyLocaluser")
    $user.setinfo()
    $user.SetPassword("P@ssw0rd")
    $Group = [ADSI]"WinNT://./Users,Group"
    $Group.Add("WinNT://$user,user")
    i checked, user is created but is doesn't become member of local "Users" group
    Scenario2 (which is my Real Scenario):
    $myVMnumber = read-host "enter your VMnumber"
    $computer = [ADSI]"WinNT://."
    $user = $computer.Create("User","MyLocalUser$MyVMnumber") ----># for example on VM2, will be created as "MyLocalUser2"
    $user.setinfo()
    $user.SetPassword("$MyVMnumber") # ---> so that the password of MyLocaluser be the digit 2
    $Group = [ADSI]"WinNT://./Users,Group"
    $Group.Add("WinNT://$user,user")
    what change should make to the code?
    Many thanks in advanced

    Is there some reason why you are posting the same question in multiple forums?
    I gave you the exact answer and a copy of tested code.
    Someone needs to merge these two threads:
    https://social.technet.microsoft.com/Forums/en-US/98ab1abd-ef62-4b95-b70c-a6f0120a155e/unable-to-add-local-usr-to-local-group-via-adsi?forum=winserverpowershell
    ¯\_(ツ)_/¯
    no it's the same powershell forum not multiple forums
    i had posed my question in previous threat
    https://social.technet.microsoft.com/Forums/en-US/98ab1abd-ef62-4b95-b70c-a6f0120a155e/unable-to-add-local-usr-to-local-group-via-adsi?forum=winserverpowershell
    but at the middle of the scenario, no one continue to investigate on my problem, so i started new threat to investigate on the rest of the problem, but finally you answered it & now this threat can be closed up
    many thanks for your helps. 

  • How to configure Airport Extreme AFP disk sharing to host multiple users' home-directories (Lion, using autofs)

    I have this working, but only by completely bypassing access control, using guest access with read+write permissions.
    Do I need to buy Lion Server, to do this. All my past unix/linux experience says Lion Server should _not_ be necessary.
    This seems like a simple & obvious setup objective, but it is proving to be harder than I would imagine.
    Setup:
    multiple users, sharing two mac mini's running OSX Lion
    connected to an Airport Extreme (4th gen) with a USB disk shared (either via disk password, AEBS password, or using AEBS user's passwords).
    After much experimentation and web research, I finally have managed to get the mini's to auto mount the Airport Extreme's AFP shared USB disk. Well almost... It only works if, on the Airport, I set the guest access permissions to read+write and select the "Secure Shared Disks" method to "With disk password" or "with Airport Extreme password".  In other words, it only works if I essentially bypass/disable access control by using the guest authentication mechanism to the AFP shared disk.
    On the Lion side of this, I am automounting the users directories via "autofs". The config files for this are
    /etc/auto_master:
    # Automounter master map
    +auto_master            # Use directory service
    /net                    -hosts          -nobrowse,hidefromfinder,nosuid
    /home                   auto_home       -nobrowse,hidefromfinder
    /Network/Servers        -fstab
    /-                      -static
    /-                      auto_afp
    /etc/auto_afp:
    # Automounter AFP master map
    # https://discussions.apple.com/thread/3336384?start=0&tstart=0
    /afp/users -fstype=afp afp://;AUTH=No%20User%[email protected]/Users/
    Then, after rebooting and verifying read+write access to the /afp/users directories, I change each user's home directory: In System Preferences > System > Users & Groups, I right-click over the users to access the Advanced Options, changing the Home directory field to point at the AFP-mounted /afp/users/Users/* home directories.
    I experimented with alternate UAM specifications, as well as both OSX and AESB users & passwords. Using guest access is the only thing that has worked.
    Any pointers would be appreciated...

    Based on lots more experimentation which confirms the information in a parallel discussion (cf. Automount share as non ROOT or SYSTEM user! https://discussions.apple.com/thread/3221944), I have concluded that the Lion 10.7.2 implementation of AutoFS mechanism is broken. I submitted a bug report via apple.com/feedback.
    Work arounds..?
    Earlier I wondered if installing Lion OSX Server was necessary.  The more I contemplate this, the more I am convinced it _should_not_ be necessary. The client-server architecture is clear: my mac's are the file-server client's and the Airport Extreme is supposed to act as the file server. The only thing instaling Lion Server would do (besides enriching Apple.com) is enable me to configure one of the mac's as the file server. This would require it to be "always on" (thus enriching my electric utility as wel).  Okay, an additional benefit would be configuring software RAID disks attached to the Lion server, but Time Machine has worked fine for me in the past, backing up to disks mounted on the Airport Extreme.
    One solution is to create a disk partition for each user and instruct each user to connect / authenticate to the Airport Extreme AFP share at login.  The multiplicity of partitions is necessary since the first user to mount the AFP share, takes ownership of it, blocking other users from accessing that disk partition.  A user can "steal" ownership by reconnecting, but this will leave the other user's applications & open files dangling.
    This disfunctional situation really *****.  Before instaling Lion, I put a 64 GB SSD (solid state disk) in each of our mac's. I did this expecting to easily configure the /Users/* data on external networked storage. I'm having a dejavu "Bill Gates"-ware moment; problems like this were why I abandoned Windoz.
    I will make a few more experiments using the depreciated /etc/fstab mechanism.  Maybe that will bypass the broken-ness of AutoFS...? Alternately, I guess I could also try to run Kerberos authentication to bypass whatever is broken in AutoFS, but that would require a running a Kerberos daemon somewhere.  Possibly I could configure a Kerberos service to run on both my mac's (without installing Apple's Lion Server)...?
    Stay tuned...

Maybe you are looking for