Thursday, August 18, 2011

Adding an Additional Distribution Group Manager/Owner

In Exchange 2010 a group owner/manager is modified by using Set-DistributionGroup with the ManagedBy parameter. You can also configure this parameter in the Exchange Management Console in the properties of the group. Only users can be listed here, not groups. However, you can add multiple users.

If you are updating only a single distribution group then the graphical interface in the Exchange Management Console works well. If you have many distribution groups to update then you will probably be scripting the process in the Exchange Management Shell.

In the Exchange Management Shell, you allow multiple managers of a distribution list by including them as a comma separated list as shown below:
Set-DistributionGroup Accounting -ManagedBy Jeff,Susan

However, it becomes a bit more complicated if you want to add a new person as a group manager. Overall, you need to obtain the list of current managers in a variable, add the new user, and then set the ManagedBy parameter using the entire array. If you specific just a single user then the existing list is overwritten. Let's take a look at the process.

First, obtain the current list of managers:
$Grp=Get-DistributionGroup "All Company"
$List= $Grp.ManagedBy

The next bit is a little tricky. The $List variable is an array of Active Directory objects. You can verify this by displaying the contents of the $List variable as shown below.


If you attempt to just add a name to the $List array, it won't work because the name is treated as a string rather than the name of an Active Directory object. So, instead you need to create another variable with the Active Directory object of the user you want to add. The example below shows how put the Active Directory object for Anna in the variable $New and then add it to the existing $List array. If you are scripting this, the name "Anna" can be replaced with a variable containing the name of the user. The variable can be populated from a csv file.
$New=Get-User Anna
$List+=$New

If you display the contents of the $List variable, you can see that Anna has been added. The object is different from the original two objects, but it is similar enough for the Set-DistributionGroup cmdlet to accept it.


Finally, we can set the ManagedBy for the group:
Set-DistributionGroup "All Company" -ManagedBy $List

I should also note that while there is no built in functionality for a security group to manage a distribution list, you can fake it by using these instructions provided by the Exchange Team at http://blogs.technet.com/b/exchange/archive/2011/05/04/how-to-manage-groups-with-groups-in-exchange-2010.aspx.

1 comment:

  1. On a side note, even if you run it from the exchange shell, even with your administrator account you may receive an insufficient rights error. For this just add: -BypassSecurityGroupManagerCheck at the end of the set-* command.

    ReplyDelete