Ok, didnt realize this was Exo.
I just tested this and it worked:
Get-DistributionGroup -ResultSize unlimited | ?{$_.Managedby -ne 'Organization Management'}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Get-DistributionGroup -ResultSize unlimited | where {($_.DisplayName -notlike 'SDL_*') -or ($_.managedby -notcontains "*Organization Management*")} | ft displayname, managedby
I'm running the above powershell. I've used -notcontains, notequal, notlike and I'm still having distribution lists returned that contain organization management as an owner. What am I missing? I feel like Exchange for some reason added the role Organization management as an owner and that isn't an object the conditions are tracking for.
Ok, didnt realize this was Exo.
I just tested this and it worked:
Get-DistributionGroup -ResultSize unlimited | ?{$_.Managedby -ne 'Organization Management'}
Hi @DavidAz
Do you mean the owner not a member of the default Admin role => Organization Management?
Please note that the ManagedBy parameter specifies an owner for the group. The owner you specify for this parameter must be a mailbox, mail user or mail-enabled security group (a mail-enabled security principal that can have permissions assigned).
Also, note that the managedby returns an array. You may need to get the members of the admin role firstly then match the members with them.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
This was the solution
[string]@($_.ManagedBy) -notmatch "Organization Management")}