HOW TO Update multi-valued attributes in PowerShell

by Bharat Suneja on February 19, 2007

Multivalued attributes are simply attributes that can have more than one value. Examples include members attribute of groups, or proxyAddresses attribute of recipients.

In GUI interfaces, it is simple to add/modify multivalued attributes. VBScript has control codes that allow you to control the interaction with multi-valued attributes – 1 = clear all entries, 2 = update all entries, 3 = append, and 4 = delete.

Exchange shell uses Add commands to add new entries to some multivalued attributes – e.g. Add-IPBlockListEntry to add another IP address or range to the IP Block List.

However, if you want to add more values to stuff like BypassedSenderDomains in ContentFilterConfig, there’s no equivalent of an Add command. If you try to add a value to the attribute using the following syntax, the existing values will be replaced by the newer ones:

Set-ContentFilterConfig -BypassedSenderDomains “”

You could copy the existing values (e.g.,, and paste these along with the new value:

Set-ContentFilterConfig -BypassedSenderDomains “”,””,””

However, this copying and pasting can be tricky for attributes that have a lot of values. Another alternative (..thanks to Vivek for the suggestion):

$foo.BypassedSenderDomains +=””
$foo | Set-ContentFilterConfig

This is a great workaround… and it works!

However, it’d be much easier to have a switch that lets you append to such multi-valued attributes, in keeping with the shell’s promise of allowing most operations using one-liners.. something like Set-ContentFilterConfig -BypassedSenderDomains, to add values to the attribute, and some other combination to remove a particular value.

To remove a value from a multivalued attribute, for example from the BypassedSenderDomains property of the ContentFilterConfig used in the preceding example:

$foo.BypassedSenderDomains -=””
$foo | Set-ContentFilterConfig

{ 23 comments… read them below or add one }

Leave a Comment

Previous post:

Next post: