Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Distribution List based on Zip/Postal Code 1

Status
Not open for further replies.

F1lby

MIS
Oct 1, 2001
472
0
0
GB
Hi,
I'm trying to create a dynamic distribution list based on Zip/Postal Code.... without any success.

Does anyone know what variable the Zip/Postal Code needs when creating the list in Powershell?

Creating the dynamic distribution lists in Powershell is straighforward enough... but to base it on Zip/Postal Code seems to be a challenge.

I've tried various variables, but none of them work...

New-DynamicDistributionGroup -Name "SF-Users" -OrganizationalUnit "OUorContainerNameToCreateGroupIn" -RecipientContainer "yourdomain.com" -RecipientFilter {RecipientType -eq "UserMailbox" -and City -eq "San Francisco"}
This works fine for City as an example..

But I cannot find what I need to replace the 'City' bit with, to get Exchange to work against the Zip/Postal code.... I've tried all possible permutations, alas none work...

Best Regards

Phil Blythe

 
Can you be more specific as to what errors (if any) you're getting? Can you provide the syntax you've used for zip codes?

Code:
New-DynamicDistributionGroup -Name "SF-Users" -OrganizationalUnit "mydomain.local/myco/users" -RecipientContainer "mydomain.com" -RecipientFilter {RecipientType -eq "UserMailbox" -and PostalCode -eq 48313}

works fine for me.

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
Brilliant! That works great!
'PostalCode' being the syntax I did not know. I tried postcode, postal code, zipcode.. none of which worked.

Many Thanks!!

A+++
 
Brilliant! That works great!
'PostalCode' being the syntax I did not know. I tried postcode, postal code, zipcode.. none of which worked.

Many Thanks!!

A+++
 
So, I wasn't sure what it was either, so I fired up ADSIEDIT and looked at a user account.

Glad that it worked for you. I've helped some companies do a transport rule disclaimer that was based on their country. Plenty of flexibility with Exchange!

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top