Link to home
Start Free TrialLog in
Avatar of RJHarvey72
RJHarvey72Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Issues with -RecipientFilter in Exchange Powershell

I am using Powershell to create Dynamic Distribution Groups within Exchange and am having trouble getting it to work with the -like operator. Examples are below of what is working and what isn't working.  TechNet suggests that StreetAddress is a string and therefore -like should work with it.

There are good reasons why we aren't simply filtering on the Office attribute and are trying to use Street.

Any help greatly appreciated.

Working
New-DynamicDistributionGroup '# Glasgow' -OrganizationalUnit 'domain/Groups/Distribution Groups' -RecipientContainer 'domain/User Accounts' -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (StreetAddress -eq '12 High St Glasgow G1 4PT'))}

Not Working
New-DynamicDistributionGroup '# Glasgow' -OrganizationalUnit 'domain/Groups/Distribution Groups' -RecipientContainer 'domain/User Accounts' -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (StreetAddress -like 'Glasgow'))}

I would simply use the -eq option however one of our office addresses has two apostrophes in it which causes issues.
ASKER CERTIFIED SOLUTION
Avatar of Amit Kumar
Amit Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RJHarvey72

ASKER

Thanks very much, that has resolved it.