Hi all I have a specific problem trying to solve, have tried writing my own script but not getting results I want.
I work for a company that owns 4 other companies. They all operate as microsoft tenants for each other. My supervisor wants a DDL for each company . The first list should contain all users in the company who are not disabled(sign on blocked) and only the users. Some of the ‘resources’ are conference rooms which have an associated email. I have to exclude those.
Then a need to create serperate DDL’s which exclude the external tenant accounts, I think I can filter by domain I’d imagine.
So far im trying this
Set-DynamicDistributionGroup 'testdl1' -RecipientFilter {(-not(RecipientTypeDetailsValue -eq 'SharedMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'RoomMailbox')) -and (-not(RecipientType -eq 'MailContact')) -and -not(UserAccountControl -eq "AccountDisabled, NormalAccount") -and (-not(RecipientType -eq 'MailUniversalDistributionGroup')) -and (-not(RecipientTypeDetailsValue -eq 'EquipmentMailbox'))}
This ends up giving me disabled users and DLs also. I don’t think it’s including conference rooms those.
I am using this
Get-Recipient -RecipientPreviewFilter ($FTE.RecipientFilter) | fl DisplayName
so I can look without the long GUID.
Any help is appreciated
eryan-work is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.