• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

Powershell Script for mass Group membership

Hey guys!!

I am working on an Active Directory group cleanup (to the tune of 600+ groups deleted and 450+ groups created and populated) project.

I got help from EE last week on how to create a list of groups from a reference .CSV file. I am trying to get a script going that would reference a list of users (i..e):

Bob Roberts
Mike Michaels
Jimmy James

...and add them to a list of groups

Information Technology
Information Technology-Private Files
Information Technology-Mail Distribution

I have the Quest cmdlets installed.

Any help you could provide would be awesome!
1 Solution
Chris DentPowerShell DeveloperCommented:

So if you had a list of users in a text file we could do something like this.

I reckon this will need some tweaking, but it's a reasonable enough place to start.

Get-Content "TextFile.txt" | %{
  $UserDN = (Get-QADUser $_).DN
  Add-QADGroupMember "Information Technology" -Member $UserDN
  Add-QADGroupMember "Information Technology-Private Files" -Member $UserDN

Open in new window

brianromaAuthor Commented:
It works like champ, Chris!!

You rock--thanks!


Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now