Link to home
Start Free TrialLog in
Avatar of Scott
ScottFlag for United States of America

asked on

Office 365 powershell help

Creating new dynamic distribution groups in office 365.  Here is an example of the command that used to work with on-prem:  New-DynamicDistributionGroup -Name "All IT" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Title -like '*Tech*')    

BUT you can no longer do leading wildcards in o365.  I tried to use  (Title -contains 'Tech*'), but I receive an error that -contains is not a valid operator.   Any ideas of what I could use?  I know -contains is an operator, but obviously I am doing something wrong.
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Yup, this is an unfortunate limitation, and what's even more annoying is that leading wildcards are supported for the exact same type of recipient filter, when used with New-AddressList for example. The usual workaround is to rely on other attributes, for example you can easily do a client-side filter for *tech*, populate extensionattribute10 with some value for each of those, then use extensionattribute10 in the filter for the DDG. Personally, I dont like this method, as if I wanted to do it like that, I would simply create a regular DG. And of course it needs constant updating.

If nothing else, you can certainly break the query down to multiple statements using the -like operator, without leading wildcard.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.