Adding multiple users from a group to an Active Directory group using PowershellPowerShell and Active Directory User Management(Powershell) Method to return a list of groups where a specific user has 'write member' securityPowershell show users who are members of a group twice - once directly once indirectlyPowershell to add users to a groupPowershell - Find users belonging to more than one AD groupWhen I add users to a Security Group using Powershell, they don't show up in ADCreating active directory users with powershell - the mapped home folder is not mapping until editedAdding AD groups using powershellHow to allow security group members to manage other group membership in Active DirectoryPowershell script Import Users from CSV, add to group, with Success/Fail logs

tabular: caption and align problem

Is Lambda Calculus purely syntactic?

60s or 70s novel about Empire of Man making 1st contact with 1st discovered alien race

Java Servlet & JSP simple login

Separate SPI data

Please figure out this Pan digital Prince

Who voices the small round football sized demon In Good Omens

Smart-expansion of a range to a list of numbers

I have a problematic assistant manager, but I can't fire him

Does the new finding on "reversing a quantum jump mid-flight" rule out any interpretations of QM?

How can I remove material from this wood beam?

Origin of "boor"

How to prove a 4D vector is a 4-Vector?

Can we completely replace inheritance using strategy pattern and dependency injection?

How do free-speech protections in the United States apply in public to corporate misrepresentations?

Does the Nuka-Cola bottler actually generate nuka cola?

How do we say "within a kilometer radius spherically"?

Amplitude of a crest and trough in a sound wave?

Teaching a class likely meant to inflate the GPA of student athletes

Is there a set of positive integers of density 1 which contains no infinite arithmetic progression?

What would be the way to say "just saying" in German? (Not the literal translation)

Why do radiation hardened IC packages often have long leads?

Why does this query, missing a FROM clause, not error out?

Did Apple bundle a specific monitor with the Apple II+ for schools?



Adding multiple users from a group to an Active Directory group using Powershell


PowerShell and Active Directory User Management(Powershell) Method to return a list of groups where a specific user has 'write member' securityPowershell show users who are members of a group twice - once directly once indirectlyPowershell to add users to a groupPowershell - Find users belonging to more than one AD groupWhen I add users to a Security Group using Powershell, they don't show up in ADCreating active directory users with powershell - the mapped home folder is not mapping until editedAdding AD groups using powershellHow to allow security group members to manage other group membership in Active DirectoryPowershell script Import Users from CSV, add to group, with Success/Fail logs






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








3















I have a powershell script that is supposed to go through a specific ou and store the groups into a variable $groups. Here is the code I use in the script:



$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=GFS-USERS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Server "ou.ad3.blabla.com"
Foreach($G In $Groups)

Write-Host $G.Name
Write-Host "-------------"
$G.Members



This step seems to work fine.



In my next part of my script I have it go through each group and attempt to add the users from each group into a group where they should all be combined. The code is as follows:



foreach ($group in $groups)

Add-ADGroupMember -Identity "CN=test,OU=AFS-OU-ACLs-EDMS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Members (Get-ADGroupMember $group) -Server "ou.ad3.blabla.com"



When I run the script, it works fine for all users from:



OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com


but for all other users I get the following error:



Add-ADGroupMember : The server is unwilling to process the request
At line:1 char:22


Does anyone know if this is a permissions issue or if there is something I am doing wrong?










share|improve this question






















  • Can you list the CN of a failed user?

    – uSlackr
    Apr 27 '15 at 20:46











  • CN=vlowens,OU=blablaUsers,DC=ad3,DC=blabla,DC=com

    – yhussain
    Apr 27 '15 at 20:48












  • The users that failed are in a parent ou, so i'm guessing that means it's a permissions thing?

    – yhussain
    Apr 27 '15 at 22:10











  • Yes, while I cannot say for sure right now, I suspect the account making the change needs permission to change both the group and the user account.

    – uSlackr
    Apr 28 '15 at 13:11

















3















I have a powershell script that is supposed to go through a specific ou and store the groups into a variable $groups. Here is the code I use in the script:



$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=GFS-USERS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Server "ou.ad3.blabla.com"
Foreach($G In $Groups)

Write-Host $G.Name
Write-Host "-------------"
$G.Members



This step seems to work fine.



In my next part of my script I have it go through each group and attempt to add the users from each group into a group where they should all be combined. The code is as follows:



foreach ($group in $groups)

Add-ADGroupMember -Identity "CN=test,OU=AFS-OU-ACLs-EDMS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Members (Get-ADGroupMember $group) -Server "ou.ad3.blabla.com"



When I run the script, it works fine for all users from:



OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com


but for all other users I get the following error:



Add-ADGroupMember : The server is unwilling to process the request
At line:1 char:22


Does anyone know if this is a permissions issue or if there is something I am doing wrong?










share|improve this question






















  • Can you list the CN of a failed user?

    – uSlackr
    Apr 27 '15 at 20:46











  • CN=vlowens,OU=blablaUsers,DC=ad3,DC=blabla,DC=com

    – yhussain
    Apr 27 '15 at 20:48












  • The users that failed are in a parent ou, so i'm guessing that means it's a permissions thing?

    – yhussain
    Apr 27 '15 at 22:10











  • Yes, while I cannot say for sure right now, I suspect the account making the change needs permission to change both the group and the user account.

    – uSlackr
    Apr 28 '15 at 13:11













3












3








3








I have a powershell script that is supposed to go through a specific ou and store the groups into a variable $groups. Here is the code I use in the script:



$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=GFS-USERS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Server "ou.ad3.blabla.com"
Foreach($G In $Groups)

Write-Host $G.Name
Write-Host "-------------"
$G.Members



This step seems to work fine.



In my next part of my script I have it go through each group and attempt to add the users from each group into a group where they should all be combined. The code is as follows:



foreach ($group in $groups)

Add-ADGroupMember -Identity "CN=test,OU=AFS-OU-ACLs-EDMS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Members (Get-ADGroupMember $group) -Server "ou.ad3.blabla.com"



When I run the script, it works fine for all users from:



OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com


but for all other users I get the following error:



Add-ADGroupMember : The server is unwilling to process the request
At line:1 char:22


Does anyone know if this is a permissions issue or if there is something I am doing wrong?










share|improve this question














I have a powershell script that is supposed to go through a specific ou and store the groups into a variable $groups. Here is the code I use in the script:



$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=GFS-USERS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Server "ou.ad3.blabla.com"
Foreach($G In $Groups)

Write-Host $G.Name
Write-Host "-------------"
$G.Members



This step seems to work fine.



In my next part of my script I have it go through each group and attempt to add the users from each group into a group where they should all be combined. The code is as follows:



foreach ($group in $groups)

Add-ADGroupMember -Identity "CN=test,OU=AFS-OU-ACLs-EDMS,OU=AFS-OU-Groups,OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com" -Members (Get-ADGroupMember $group) -Server "ou.ad3.blabla.com"



When I run the script, it works fine for all users from:



OU=AFS,OU=FA,OU=DEPARTMENTS,DC=ou,DC=ad3,DC=blabla,DC=com


but for all other users I get the following error:



Add-ADGroupMember : The server is unwilling to process the request
At line:1 char:22


Does anyone know if this is a permissions issue or if there is something I am doing wrong?







active-directory powershell






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 27 '15 at 20:32









yhussainyhussain

972514




972514












  • Can you list the CN of a failed user?

    – uSlackr
    Apr 27 '15 at 20:46











  • CN=vlowens,OU=blablaUsers,DC=ad3,DC=blabla,DC=com

    – yhussain
    Apr 27 '15 at 20:48












  • The users that failed are in a parent ou, so i'm guessing that means it's a permissions thing?

    – yhussain
    Apr 27 '15 at 22:10











  • Yes, while I cannot say for sure right now, I suspect the account making the change needs permission to change both the group and the user account.

    – uSlackr
    Apr 28 '15 at 13:11

















  • Can you list the CN of a failed user?

    – uSlackr
    Apr 27 '15 at 20:46











  • CN=vlowens,OU=blablaUsers,DC=ad3,DC=blabla,DC=com

    – yhussain
    Apr 27 '15 at 20:48












  • The users that failed are in a parent ou, so i'm guessing that means it's a permissions thing?

    – yhussain
    Apr 27 '15 at 22:10











  • Yes, while I cannot say for sure right now, I suspect the account making the change needs permission to change both the group and the user account.

    – uSlackr
    Apr 28 '15 at 13:11
















Can you list the CN of a failed user?

– uSlackr
Apr 27 '15 at 20:46





Can you list the CN of a failed user?

– uSlackr
Apr 27 '15 at 20:46













CN=vlowens,OU=blablaUsers,DC=ad3,DC=blabla,DC=com

– yhussain
Apr 27 '15 at 20:48






CN=vlowens,OU=blablaUsers,DC=ad3,DC=blabla,DC=com

– yhussain
Apr 27 '15 at 20:48














The users that failed are in a parent ou, so i'm guessing that means it's a permissions thing?

– yhussain
Apr 27 '15 at 22:10





The users that failed are in a parent ou, so i'm guessing that means it's a permissions thing?

– yhussain
Apr 27 '15 at 22:10













Yes, while I cannot say for sure right now, I suspect the account making the change needs permission to change both the group and the user account.

– uSlackr
Apr 28 '15 at 13:11





Yes, while I cannot say for sure right now, I suspect the account making the change needs permission to change both the group and the user account.

– uSlackr
Apr 28 '15 at 13:11










1 Answer
1






active

oldest

votes


















0














Consider looping through and adding members to the new group one at a time from the old group.



$CombinedGroup = ...
$Groups = Get-ADGroup ...
foreach ($Group in $Groups)
$Members = GetADGroupMember $Group
foreach ($Member in $Members) Set-ADGroup -Identity $CombinedGroup -Add $Member


}





share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "2"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f685972%2fadding-multiple-users-from-a-group-to-an-active-directory-group-using-powershell%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Consider looping through and adding members to the new group one at a time from the old group.



    $CombinedGroup = ...
    $Groups = Get-ADGroup ...
    foreach ($Group in $Groups)
    $Members = GetADGroupMember $Group
    foreach ($Member in $Members) Set-ADGroup -Identity $CombinedGroup -Add $Member


    }





    share|improve this answer



























      0














      Consider looping through and adding members to the new group one at a time from the old group.



      $CombinedGroup = ...
      $Groups = Get-ADGroup ...
      foreach ($Group in $Groups)
      $Members = GetADGroupMember $Group
      foreach ($Member in $Members) Set-ADGroup -Identity $CombinedGroup -Add $Member


      }





      share|improve this answer

























        0












        0








        0







        Consider looping through and adding members to the new group one at a time from the old group.



        $CombinedGroup = ...
        $Groups = Get-ADGroup ...
        foreach ($Group in $Groups)
        $Members = GetADGroupMember $Group
        foreach ($Member in $Members) Set-ADGroup -Identity $CombinedGroup -Add $Member


        }





        share|improve this answer













        Consider looping through and adding members to the new group one at a time from the old group.



        $CombinedGroup = ...
        $Groups = Get-ADGroup ...
        foreach ($Group in $Groups)
        $Members = GetADGroupMember $Group
        foreach ($Member in $Members) Set-ADGroup -Identity $CombinedGroup -Add $Member


        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 31 '16 at 18:22









        XalorousXalorous

        693215




        693215



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Server Fault!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f685972%2fadding-multiple-users-from-a-group-to-an-active-directory-group-using-powershell%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

            What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

            Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos