Powershell - Batch Update AD User Object > Member Of Tab

I have over 80 users that I need to update their "Member Of" field in their AD User Object > Member Of Tab

I have two GPOs to add, possibly three.

The users are in a txt and CSV file.

Is there a PS script that will process the update?
Mike DiasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Import-Csv GroupMembers.csv | % { Add-ADGroupMember $_.Group -Member $_.User }

Open in new window

If the csv fle has rhe columns Group and User, and only a single user per row.
Mike DiasAuthor Commented:
Thanks for this. I'll try this tomorrow.
Mike DiasAuthor Commented:
Found it. Thanks.

$grp = 'GIT_GS_AMU_Windows7_Object '

Import-Module ActiveDirectory 
$comps=Get-Content names.txt 

$grpDN = (get-adgroup $grp).distinguishedname

foreach ($comp in $comps)
{$dns=get-aduser $comp
Add-ADGroupMember -Identity  $grpDN -member $dns 

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike DiasAuthor Commented:
Script based and solves the issue.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.