Wednesday, January 4, 2012

Multi-Valued Custom Attributes

As I mentioned in my previous post, Exchange 2010 SP2 introduces “multi-value custom attributes”. But what exactly does this mean? Basically, now there are 5 new custom attributes that can hold more than one value: ExtensionCustomAttribute1 to ExtensionCustomAttribute5, which can now hold up to 1,300 values each! Why do we need to store more than 1 value when we have 15 CustomAttributes?! Well, you might want to save in ExtensionCustomAttribute1 all the times you increased the user’s mailbox or all the databases you moved the user from/to, etc... I’m sure someone will come up with a good use for them!

If we compare CustomAttributes with ExtensionCustomAttributes, we can see that the new ones are stored in an array to allow for multiple values:

These parameters are used by the following cmdlets:
  • Set-DistributionGroup
  • Set-DynamicDistributionGroup
  • Set-Mailbox
  • Set-MailContact
  • Set-MailPublicFolder
  • Set-RemoteMailbox

As you can see from this list, you can use attributes with Distribution Groups, Mailboxes, Contacts, mail enabled Public Folders and Remote Mailboxes.

There are several methods of saving data in these attributes. First, let’s look at how we can set new values:

Now let’s add values to the existing ones. Here we have two options:
  1. Using the “normal” method that most administrators are used to;
  2. Using the Add functionality introduced with SP1.

As you can see, the second method is much easier! A very welcome improvement.

To remove, we can also use both methods but, again, the easiest one is the second:

Hope this helps and please let me know if you plan to use them and for what!


  1. Thanks! Your examples work for me, but I need to load ExtensionCustomAttribute1 from a CSV file where each row is a mailbox. Can you help me with that?

  2. You're welcome! How many attributes do you want to save into each ExtensionCustomAttribute1? Are they all in the same field of the CSV? You can do something like (assuming your CSV has headers):

    Import-Csv Users.csv | ForEach { Set-Mailbox $_.User -ExtensionCustomAttribute1 $_.ECA1 }

  3. Hi, thanks for this ! I'm using custom attributes for distribution groups. I need to set an extra custom attribute to a mailbox, i did your example then i can see the ExtensionCustomAtribute is set, but my mailbox is not in 2 different distribution groups.
    Are the ExtensionCustomAttribute working with distribution groups ?? Thanks a lot man :)
    (sorry for english :x)

    1. Hi!
      You're welcome! :) And apologies for the delay in replying...
      Let me see if I understood what you are trying to do: you are using the ExtensionCustomAtribute with more than one value (for example, value1 and value2). Then you have 2 different DLs, DL1 looks for value1 and DL2 looks for value2.
      However, the mailbox is still not part of both DLs.
      Is this correct?
      Can you show the cmdlets you ran as this should be working without any problems?

      Regards, Nuno

  4. Thanks for the reply !
    I have a mailbox who got 3 custom attributes (Not the extensionattributes). the first one for the function(ex: DIRECTOR), the second for the country (ex: FRANCE), the third for the agency (ex : DRXXX). Then the user's mailbox is dynamically added to dynamics distribution groups he diserve.
    I wanted to know if it's possible to use extensionCustomAttribute 1, added to CUstom attribute 1, (Ex : DIRECTOR + TRAINER). So the mailbox will be added to 2 differents dynamic distribution groups that uses custom attribute 1. (ex : + FR DIRECTORS and + FR TRAINERS).
    I have this problem because you can't do an OR function with custom attributes. You can just do an AND function so it doesn't work :((.

    I hope you can understand my problem :D. Thanks a lot !


    1. Hi Mathieu,

      Apologies for the delay in replying to you...
      Actually you can :) If you use the RecipientFilter parameter you can filter the mail-enabled recipients used to build the dynamic distribution group. This parameter uses OPath syntax, meaning you can do ORs, ANDs, etc.

      Here's how you create one:

      New-DynamicDistributionGroup -Name Europe -RecipientFilter {CustomAttribute2 -eq "France" -or CustomAttribute2 -eq "Portugal"}

      This way, all users that have France or Portugal in their CA2 will be added to the Europr DDL :)

      Is this what you are looking for?

  5. Hi !
    Thanks for the reply ! i finally made it ! i solved the problem by recreate a distributiongroup with the powershell like you said ! thanks a lot for the help man :).
    Hope this will help some other people x).
    Thanks for all this and your fantastic blog :))))

    Cheers from Lyon France !

    1. Excellent, glad to hear that! :)
      Thanks a lot for the compliment, really appreciate it :)

      Cheers, Nuno