Exchange Server - Hide From Exchange Address Lists

Asked By Jeff on 01-Apr-10 11:42 AM
I am trying to get the check box that says "Hide From Exchange Address
Lists" checked for about 900 mail contacts in our exchange 2007
system.  To select the users, I enter this into powershell:

get-user -filter {WindowsEmailAddress -eq '*@MyCompany.com'}

When I do that, it pulls every user that I am interested in.  However,
when I try to pipe that into get-mailcontact, I get an error that says
the user that was piped in cannot be found on the domain controller.
I have tried forcing it to different domain controllers and always get
the same result.

Any suggestions for getting around this?

Thanks.


Karl Mitschke replied to Jeff on 01-Apr-10 12:51 PM
Hello Jeff,


Why not use Get-MailContact?

Get-MailContact  -filter {WindowsEmailAddress -eq '*@MyCompany.com'} |Set-MailContact
-HiddenFromAddressListsEnabled: $True -whatif


Karl
http://unlockpowershell.wordpress.com/
Jeff replied to Karl Mitschke on 01-Apr-10 01:13 PM
Karl,

Thanks for your reply.  I tried just using get-mailcontact and the
syntax you provide works.  However(and this is what I find puzzling),
when I use get-mailcontact like you suggest, it does not error out, but
I also do not get any results back.  However, replacing get-mailcontact
with get-user gives me all of the entries I am trying to find.

Thanks,
Jeff

,
|Set-MailContact
Rich Matheisen [MVP] replied to Jeff on 01-Apr-10 09:55 PM
it is unlikely that mail-enabled Contacts will have a primary SMTP
proxy address in one of your domains. They'd have e-mail addresses in
other domains.

FYI, using the WindowsEmailAddress property can be misleading. The
property is named appropriately -- it is not used by Exchange. You'd do
much better using the PrimarySmtpAddress property.
---
Rich Matheisen
MCSE+I, Exchange MVP