INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Set-DistributionGroup -Managed by for all Distribution Groups

Set-DistributionGroup -Managed by for all Distribution Groups

Set-DistributionGroup -Managed by for all Distribution Groups

(OP)
We just completed an Exchange Cross Forest migration and now need to update all of the Distribution Group owners since those don't come across with the migration.

Is there a way to use two CSV files (one has group names only, and one has group name and owner names) and perform an set-distributiongroup -managedby ManagerName where groupname from one CSV = groupname from second CSV?

Here is what I am trying currently, but do not think I am even close, or if this is even possible:

CODE --> powershell

$managers = import-csv c:\managers.csv
 $groups = import-csv C:\groups.csv
 
 foreach($manager in $managers) 
    {
    $groupname = $manager.group
    $managedby = $manager.manager

    Foreach ($Group in $Groups) {Set-Distributiongroup  $Group -Managedby $managedby where $Group = $groupname}
    } 

Any suggestions would be great!

RE: Set-DistributionGroup -Managed by for all Distribution Groups

I don't think you need 2 files, if one already has all the information you need, in it.
I haven't tested this, but maybe it will point you in the correct direction.

CODE -->

## Assuming your Managers.CSV file contains columns with the headings: GroupName & OwnerName

$managers = import-csv c:\managers.csv
$foreach ($manager in $managers)
	{Set-Distributiongroup $manager.GroupName -Managedby $manager.OwnerName} 


Light travels faster than sound. That's why some people appear bright until you hear them speak.

RE: Set-DistributionGroup -Managed by for all Distribution Groups

(OP)
Yep, I figured that out also and was coming back to update and you had it as well. Thanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close