Modify all extension attributes of Exchange 2010 mailboxes

22 Dec

Empty all extension attributes and replace the value with NULL for all users with Exchange 2010 mailboxes

usage scenario: During a move mailbox scenario in a mid-large international company we had to empty all extension attributes (formerly called custom attributes). Some attributes still had values from a years ago migration.

First I thought to take ADModify.NET. But unfortunatly you can only replace one attribute at a time. So it would be too time-consuming with that utilitiy.

So I did a short powershell script looking for all Exchange 2010 server mailbox stores (we had 4 maibox servers with 20 databases in a DAG.

After doing that, I was able to replace all custome attributes with a NULL value.

Getting all Exchange 2010 servers

Get-mailboxserver   | where {$_.admindisplayversion -like “Version 14*”}

Looping through all Exchange 2010 server mailboxes

Get-Mailbox -server $server -resultsize unlimited

Setting new values

SET-mailbox -CustomAttribute1 $null

Full code

$servers =   Get-mailboxserver   | where {$_.admindisplayversion -like “Version 14*”}

foreach($server in $servers)

Get-Mailbox -server $server -resultsize unlimited | SET-mailbox -CustomAttribute1 $null -customAttribute2 $null -CustomAttribute3 $null -CustomAttribute4 $nullCustomAttribute5 -CustomAttribute6 $null -CustomAttribute7 $null -CustomAttribute8 $null -CustomAttribute9 $null -CustomAttribute10 -CustomAttribute11 $null -CustomAttribute12 $null -CustomAttribute13 $null -CustomAttribute14 $null -CustomAttribute15 $null | out-file c:\UserCustomAttributesNEW.txt
}

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *