<img height="1" width="1" src="https://www.facebook.com/tr?id=1529264867168163&amp;ev=PageView &amp;noscript=1">

How to Add an Exchange 2010 Custom Attribute using PowerShell

Every mailbox object in Exchange has a series of fields called custom attributes.  These can be found by right-clicking on a mailbox in the Exchange Management Console, choosing properties and then clicking on the custom attributes button in the bottom right-hand corner of the window.

custom attributes

So you ask, what might I use custom attributes for?  Within Exchange Role-Based Access Control (RBAC) there are some user-based policies can use a unique custom attribute http://technet.microsoft.com/en-us/library/ee332316(v=exchg.141).aspx. Additionally, if you are going to setup custom Address Lists you may also want to base your list on a unique custom attribute.

Set Custom Attribute for multiple users:  So in order to set this up, you will want to put together a similar PowerShell script; however, customize the file path to your environment and then save this as a .ps1 file.  This should be run via the Exchange Management Shell.

$data = get-content “c:\pathtotextfile\distros2.txt”
foreach($a in $data)
Set-Mailbox -Identity $a -CustomAttribute1 attribvalue

As for the text file, be sure the names in your text file are formatted according to each user’s mailbox Display Name with as many names as you require.  Then execute the script to modify the attribute of your choice.
For example the text file format might be similar to what you see below, but again this should be based on the display name format within your organization:
Lastname, Firstname
Lastname, Firstname

Add a custom attribute for an individual user: Run the following command within the Exchange Management Shell

Set-Mailbox -Identity “MailboxDisplayName” -CustomAttribute1 attribvalue

Remove the custom attribute manually for an individual user:

Set-Mailbox -Identity “MailboxDisplayName” -CustomAttribute1 $null

Note:  In some cases I have seen an issue where $null did not clear the custom attribute.  In this case “” was used instead.

The article applies to the standard 15 custom attributes that come with Exchange 2010 and does not apply to any of the newly added custom attributes.  For more information on these newly added attributes please see the following TechNet article.  http://blogs.technet.com/b/exchange/archive/2012/01/17/custom-aka-extension-attributes-in-exchange-2010-sp2-and-their-use.aspx