Powershell to add multiple users in multiple groups

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends today we are going to learn how to add multiple users to multiple group so before that let's try to add single user to the single group so here we have three groups Group 1 group 2 and group 3 and we have 3 users user 1 user 2 and user 3 let's try to add user 1 to you to group 1 and the command is add ad group member - identity here the identity is nothing but the group name so our group name is group 1 - members here the member is user 1 so first check out the group 1 there is no member in Group 1 execute yes user 1 is added now let us see how to add multiple users to multiple group so basically we need two inputs one is group name and username okay so let us create one CSV file I am creating one CSV file in C temp and the file name will be prove dot CSV so basically we need two inputs first is user name separated with comma second input is group name so we have three users and three groups so just enter all the user and group name user 1 comma added to Group 1 user 2 added to group 2 and user 3 and it to group 3 save the file let us try to create a script first check out the CSV file import the CSV file import CSV C : M a group dot CSV execute is we have the data these are the list of users and these are the list of groups so 5 power any command and loop the file so the command each command is for each object curly bracket open add any group member - identity so here we need to mention the group name ok so because we are looking the file we need to put a variable here the variable is dollar underscore dot group name we have to provide the heading of the CSV file so the variable is dollar underscore dot group name - sorry - members and the variable is dollar underscore dot username dollar underscore dot username curly bracket close execute and star user 1 is added to group 1 user 2 is added to group 2 and user 3 add is added to code 3 similarly if you want to remove the users from the group so here we have mentioned add ad group member so instead of add any group member just mentioned remove ad group member execute it will ask for confirmation yes I want to delete user from Group 1 group 2 and group 3 yes all users have been removed thank you for watching guys have a nice day
Info
Channel: Abhijit Bole
Views: 46,272
Rating: undefined out of 5
Keywords: Powershell to add multiple users in multipls groups, add users in groups, powershell to add users in groups, add and remove users in an active directory, powershell and ad groups, powershell and ad us, active directory, Learn PowerShell, PowerShell active directory, powershell ad, active directory users and groups, powershell script to add users to active directory, power shell, how to, bulk add ad users, microsoft powershell, microsoft
Id: usTkdfjrVE0
Channel Id: undefined
Length: 5min 24sec (324 seconds)
Published: Sat Dec 31 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.