Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a Server 2008 / Exchange 2007 box, where all our users' mailboxes live. We also have a number of distribution lists, both static and dynamic. One dynamic DL is called "Everyone" and contains, predictably enough, all the users with Exchange mailboxes.

The problem is, we also have a small number of users in a separate mailbox DB who don't technically work for us and shouldn't appear in the "Everyone" list. Even though I've checked the "Hide from exchange address lists" on all the offending users, they still show up in the preview and also (as I've just found out) receive any mail sent to it.

Is there any way of excluding these users from the DDL's filter, possibly using some PowerShell-fu, or am I going to have to create a static DL and keep it up-to-date?

share|improve this question
up vote 1 down vote accepted

Ya, this will require a little bit of PowerShell. I found this article that should be a good starting point for you.

I've modified it here and it works for me. You may want to edit to add the OU you want this in, names, aliases, etc.

$DB = (Get-MailboxDatabase "SERVER\Storage Group\Mailbox Database").distinguishedName
New-DynamicDistributionGroup MyGroup -RecipientFilter {Database -ne $DB}

Copy and paste that code into a text file, edit it to personalize it and then save it with a .PS1 file extension. Open the Exchange PowerShell, browse to the folder where the file is located and run it with .\Filename.PS1

share|improve this answer
Worked like a charm. Many thanks! – RainyRat Sep 17 '09 at 11:08

You can't.

Hide from exchange address lists only prevents them from auto completing in outlook.

A solution might be to have the list look only in a certain OU or if they are in a separate mailstore use that as the query.

I have my contractors sitting in a separate OU from the rest of the regular employees.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.