Powershell to add multiple users in multiple groups

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 38

  • @kdspland
    @kdspland 5 лет назад +3

    Great video this made my job a lot easier for adding nearly 200 users to several groups.

  • @damongrambow7077
    @damongrambow7077 7 лет назад +3

    Thats what I was looking for and a lot simpler than I thought it would be! Thanks!!

  • @Vicky.andtheMogs
    @Vicky.andtheMogs 4 года назад +1

    This has saved me so much work, I had 1300 different user/group combinations and it ran in like 5 seconds. Thanks so much for your video guide :)

    • @akhilreddy8658
      @akhilreddy8658 8 месяцев назад

      Did it work for different domains? I mean if the user is in different domains?

  • @neilokelly9208
    @neilokelly9208 6 лет назад

    Thanks bro :) Before this video, I almost had to add 350 people to a mulitple groups manually in A.d, you literally saved me hours of work.

  • @onslaught213
    @onslaught213 2 года назад

    This script saved me! The script I have is to add indiscualds to a group. Im writing a script to that will pull ownership of groups from users in a text file. A suggest for you if your looking to make another video

  • @jai3537
    @jai3537 6 лет назад +2

    Short and sweet. Thank you.

  • @halo2bullseye922
    @halo2bullseye922 Год назад

    Thanks for the video!

  • @msstrawberries02
    @msstrawberries02 4 года назад

    Simply and right to the point. Thank you

  • @gracenaghibi68
    @gracenaghibi68 3 года назад

    Thank you, this is Great, saved me lots of hours of tedious work

  • @DivitUjjwal
    @DivitUjjwal 3 года назад

    Thanks a lot Sir. you saved 30 precious minutes of my life

  • @Casshern_Sin
    @Casshern_Sin 5 лет назад +1

    Great video dude :)

  • @jayant5555
    @jayant5555 4 года назад

    If you want to add multiple users from a DL or Security group to any Security Group or DL at once use this steps
    1. Export the members in CSV file by their SamAccountName
    Get-ADGroupMember -identity “group name" | select SamAccountName | Export-csv -path -NoTypeInformation
    2. Import the user using the SamAccountName in the new SG or DL
    import-csv "path of the CSV file" | ForEach-Object {add-ADGroupMember -Identity -Members $_.SamAccountName}

  • @richievellalar3214
    @richievellalar3214 3 года назад

    I have a questions... can you answer me mate ?
    1. Security group name : MicrosoftALL
    2. Hostname : LAPTOP000012
    I still add this security group manully using AD , Select computer in AD , apply the computer name : open the profile , under member , i can add the security group under computer.
    My questions to you i make easy apply via Powershell.
    What is command in order add security group under the hostname ( members )
    can you help me.

  • @borugahagayo3462
    @borugahagayo3462 3 года назад

    thanks very helpful.. you got a tutorial to add bulk users to AD?

  • @axelrumkorf9761
    @axelrumkorf9761 4 года назад

    Thanks for the video. I am a beginner in Powersehll and am currently trying to assign students to their classes at our school. Which modules need to be installed and/or imported to execute this script? And which service do I need to connect to? I would be very happy about an answer!

  • @TheMannersmanley
    @TheMannersmanley 4 года назад

    Great Video, is there a way to add more than one user to a group using a modified script/csv? I've been trying without success..

  • @أكلاتلذيذه-ز7ت
    @أكلاتلذيذه-ز7ت 5 месяцев назад

    hello sir... if you don't mind i need a command or a script to list of members of have access for shared folders.

  • @martiscuola238
    @martiscuola238 4 года назад

    Hi, I'm trying to massively create a few hundreds Office 365 groups for ancemy organization, each with (possibly) multiple owners and members. could help me? how can I do? thank you in advance

  • @Chris-ze3ic
    @Chris-ze3ic 5 лет назад

    Hi , I am currently trying to import multiple users to multiple different groups via powershell.
    The formatting of the CSV is:
    Group Name Members
    grp1   user 1 , user 2 , user 3
    grp 2   user 5 , user 1 , user 4
    grp 3    user 6 , user 5 , user 3
    Some of the users that exist within the CSV do not currently exist so i have tried several different methods to import this but keep on getting errors
    import-csv "C:\Users\sys.c\Desktop\adgroups123.csv" | ForEach-Object {add-ADGroupMember -Identity $_.groupname -Members $_.username} is what im currently using, although i have tried other ways of trying to achieve this.
    I believe the issue that i am currently having is i need to do a -split(;) as the users are within the same cell , per row. I am therefore if i need to edit this or start over.
    I was wondering if anyone could help me with this as. I am unsure if i need to edit my csv to a different format or if powershell is capable of doing this within this format. ( i could not see anyone else trying this format on forums)
    Thanks!

  • @robshin8078
    @robshin8078 6 лет назад

    Thanks for the helpful video. What if you want to sync the AD groups to the CSV (which would mean adding and removing users)?

  • @vikramdongare8823
    @vikramdongare8823 4 года назад

    Thank you so much sir

  • @usmanshahid-vp3ie
    @usmanshahid-vp3ie 4 месяца назад

    Sorry Abhijit that is wrong (incorrect script), you added single to single group. you need nested loop to add multiple users in multiple groups

  • @npanthri
    @npanthri 5 лет назад

    Let's say groups are in different different OU, You have not defined the location. How come it adding to the correct location ?

  • @sevencostanza3883
    @sevencostanza3883 7 лет назад +1

    Great video! I have two questions though, wouldn't this command add all users to groups 1,2 and 3? It seemed they only went into one group each.
    Secondly, what if I want to import data from two different locations, can you pipline two sets of data? e.g. '$a | $b | foreach-object {add-adgroupmember -identity $a -members $b}'
    I know this code is incorrect, I'm just wondering if it is possible to pipline in variables from multiple sources?

    • @abhijitbole5946
      @abhijitbole5946  7 лет назад

      Poopsmith Enterprises
      Hello,
      Thanks for your comments.
      For the first question.
      You can add any user in any group. You need to just edit the ".csv" file. In your scenario the csv file will be as mentioned below.
      User1,group1
      User2,group1
      User3,group1
      User1,group2
      User2,group2
      User3,group2
      User1,group3
      User2,group3
      User3,group3
      -------------------------------------------------
      Answer for the second question…
      Yes its is possible with the following code.
      $Users = Get-Content C:\temp\Users.txt
      $i = 0
      ForEach($user in $users)
      {
      $group = (Get-Content C:\temp\groups.txt)[$i]
      add-ADGroupmember -Identity $group -Members $user
      $i++
      }

    • @sevencostanza3883
      @sevencostanza3883 7 лет назад +2

      Excellent. Thank you so much! :D

    • @gobindsidhu5949
      @gobindsidhu5949 7 лет назад +1

      just love your name!

    • @CkmeLe0n
      @CkmeLe0n 5 лет назад

      Here is another way to add 1 user to multiple groups
      $User = Read-Host
      $Groups = @("group1","group2","groupN")
      ForEach ($Group in $Groups) {
        Add-ADPrincipalGroupMembership $User -MemberOf $Group
      }

  • @GetSetTravel94
    @GetSetTravel94 2 года назад

    It's helps alott

  • @anb8760
    @anb8760 6 лет назад

    What would be the best way to create a log for the changes made and the failures?

  • @akhilreddy8658
    @akhilreddy8658 8 месяцев назад

    This script is not taking the email address. How can it take email

  • @vikneshvaransaravanan3208
    @vikneshvaransaravanan3208 4 года назад

    Hi how to perform the addition of same users on same groups on different number of servers

  • @dasoe55
    @dasoe55 6 лет назад

    Is there a way to make it not fail if the users are already made?

  • @nikhilkalra1530
    @nikhilkalra1530 5 лет назад

    Thanks.

  • @MrJonathanRB
    @MrJonathanRB 7 лет назад +1

    thanks

  • @doualee8481
    @doualee8481 3 года назад

    how do i put this into a script?