Creating address list based on primary SMTP address
HelloWe have an Exchange 2007 environment and I am trying to create address lists based on a query based on Primary SMTP address.Can anyone tell me if this is possible? I have tried various recipientfilters and according to the documentation there is a PrimarySmtpAddress filter - but this does not seem to work. I would like to base the address list on *@domain.com I have managed to create a powershell command based on the EmailAddress filter but this queries all email addresses not Primary only.Hope someone can help.ThanksMark
September 21st, 2009 11:40pm

Can you post the cmdlet you used to create address list based on PrimarySmtpAddress filter? Did you use something like this? New-AddressList -Name "AddressListName" -RecipientFilter {(PrimarySmtpAddress-like '*@domain.com')} Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
September 22nd, 2009 5:22am

I had hoped someone would have answered this because I could not find a simple way to do this. I could find a work around, though. You could set one of the extension attributes to something based on the domain name. Then, create the address list based on that. Like this:get-mailbox | Where {$_.windowsemailaddress -match "domainA.com"} | Set-Mailbox CustomAttribute15="DomainA"Just a thought if you cannot find a better way to do this.Jim McBee - Blog - http://mostlyexchange.blogspot.com
September 22nd, 2009 8:50am

Yes that is exactly the command I used.I used the detail in this technet article http://technet.microsoft.com/en-us/library/bb430771.aspx It does specifty thatthere is aPrimarySmtpAddress filterable property. However whenentering the command as you have detailed above it does not seem to accept and just get >>Can you help?
Free Windows Admin Tool Kit Click here and download it now
September 22nd, 2009 9:54am

Many thanks for the help. So far the command I have tried is:New-AddressList -Name "AddressListName" -RecipientFilter {(PrimarySmtpAddress-like '*@domain.com')}The problem is that this just displays >> after entering the command and it does not create the address list. Many Thanks Mark
September 22nd, 2009 9:57am

Just get >> means anyone of the bracket or quote is missing and powershell waiting for input instead of going to run the cmdlet... Looks like primarysmtpaddress doesn't get filtered for text pattern and RecipientFilter works to compare the static values instead of patterns in PrimarySmtpAddress field because I got below error while creating address list... [PS] C:\>New-AddressList -name "AddressListName" -RecipientFilter {(primarysmtpaddress -like '*@domain.com')} New-AddressList : Cannot bind parameter 'RecipientFilter' to the target. Exception setting "RecipientFilter": "Property PrimarySmtpAddress does not support Microsoft.Exchange.Data.TextFilter. Only Microsoft.Exchange.Data.ComparisonFilteris supported." At line:1 char:57 + New-AddressList -name "SMTPAddressList" -RecipientFilter <<<< {(primarysmtpaddress -like '*@domain.com')} Best bet would be, set one of the custom attribute for the recipient who has primarysmtpaddress with domain.com smtp address space as Jim said in another post... Get-Mailbox | Where{$_.windowsemailaddress -match "domainA.com"} | Set-Mailbox -CustomAttribute10 "DomainA" And create address list based on conditional custom attribute... New-AddressList -Name "DomainA AddressList" -IncludedRecipientsAllRecipients-ConditionalCustomAttribute10 "DomainA" Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
September 22nd, 2009 12:48pm

Many thanks for your help.Mark
September 22nd, 2009 2:16pm

You're welcome! Also keep in mind that after creating addresslistwith conditionalcustomattribute parameter, customattribute10 needs to be filled when new users are created to get membership in new addresslist.Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
September 22nd, 2009 3:30pm

We think we have found the solution to this: set-addresslist -Identity "TestAddressList" -recipientfilter '( ( Alias -like "*" ) -and ( ObjectClass -eq "user" -or ObjectCategory -eq "group" -or ObjectCategory -eq "publicFolder" -or recipientType -eq "UserMailbox" ) -and ( WindowsEmailAddress -like "*@primaryemail.com" -or WindowsEmailAddress -like *@secondaryemail.com ) )' Using this we only get people with either A or B as the primary SMTP address, but not users that have that email address as a secondary. Why "Windows" email address? No clue. BTW, Dmxop, I got this before and I had to quote everything in single quotes and then use double quotes on the inside. JackEdit: We found this by doing a get-mailbox and looking at the attributes with format-list. one of the attributes was WindowsEmailAddress and it had just the primary email address for that user.
October 7th, 2009 1:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics