Home > Exchange 2007 / 2010, Powershell > Exchange 2007: fix RecipientTypeDetails of Distribution Groups

Exchange 2007: fix RecipientTypeDetails of Distribution Groups

In this post I will explain how to change the RecipientType attribute via Powershell. I had a problem in Exchange 2007 that “Distribution groups” were displayed as Usermailboxes. So I figured out why this was and how I could solve this.

In AD you have two attributes: msExchRecipientDisplayType, msExchRecipientTypeDetails. When you output the Distributiongroup attributes in Exchange 2007: “Get-DistributionGroup name | fl” you can see RecipientType and RecipientTypeDetails. Following my experiences are the AD – Exchange 2007 mappings as follow:

msExchRecipientDisplayType (AD) = RecipientType (Exchange 2007)
msExchRecipientTypeDetails (AD) = RecipientTypeDetails (Exchange 2007)

When you create a new Distributionlist is the “msExchRecipientTypeDetails” value default “<not set>” in ADSI Edit:

But the attribute is still set in Exchange 2007: Get-DistributionGroup name | fl
It seems that Exchange automatically takes the RecipientType as RecipientTypeDetails.

My problem was that Distributiongroups were displayed as Usermailbox in the Exchange 2007 Console:

As you can see is the “msExchRecipientTypeDetails” configured with Value 1 which displays the Distribution group as UserMailbox:

I made a Powershell script to empty the attribute “msExchRecipientTypeDetails” from all Distribution groups that are displayed as “user mailbox” in the Exchange Console. It’s unfortunately not possible to configure the RecipientTypeDetails via Set-DistributionGroup. You must configure it via LDAP but this is harder to configure this via Powershell.

Some explanation of the script:

{$_.RecipientTypeDetails -eq “UserMailbox”} : Get all Distribution Groups that equals RecipientTypeDetails “UserMailbox”

Get-DistributionGroup $dis | foreach { $_.DistinguishedName } : Retrieve the Distinguishedname, this is necessary to get the full LDAP Path.

$LDAPPath.PutEx(1, “msExchRecipientTypeDetails”, $null): This command empties the value msExchRecipientTypeDetails

The script:

#Remove the AD attribute msExchRecipientTypeDetails from all Distribution groups that are visible as user mailboxes

#Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
$disAsUsermailbox = Get-DistributionGroup -ResultSize unlimited | where {$_.RecipientTypeDetails -eq “UserMailbox”}
#loop through all distributionLists
foreach ($dis in $disAsUsermailbox)
{

#Fix msExchRecipientTypeDetails in AD so that Distributionlist is displayed as Distributionlist and no longer as usermailbox (change from 1 to <not set>)
$DistinguishedName = Get-DistributionGroup $dis | foreach { $_.DistinguishedName }
$LDAPPath = [ADSI]"LDAP://$DistinguishedName"
$LDAPPath.PutEx(1, "msExchRecipientTypeDetails", $null)
$LDAPPath.setInfo()

}
Advertisements
  1. BillyRainbow
    May 18, 2012 at 5:26 pm

    Useful script so thanks for publishing it. Whereas Exchange 2007 was able to still see these DLs, Exchange 2010 oould not until the attribute was reset.

  2. alexis
    February 22, 2014 at 11:31 am

    You may use Long Path Tool to copy or delete your file. It really works well in this situation. For more info you may read at PathTooDeep.com

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: