create dynamic distribution group in exchange online office 365

%3CLINGO-SUB%20id%3D%22lingo-sub-1525357%22%20slang%3D%22en-US%22%3Ecreate%20dynamic%20distribution%20group%20in%20exchange%20online%20office%20365%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1525357%22%20slang%3D%22en-US%22%3E%3CP%3EFolks%2C%3C%2FP%3E%3CP%3EI%20am%20able%20to%20create%20dynamic%20security%20group%20in%20azure%20as%20below%20requirements.%3C%2FP%3E%3CP%3E-%20with%20all%20users%3CBR%20%2F%3E-%20user%20type%20should%20be%20Member%3CBR%20%2F%3E-%20excludes%20displayname%20XYZ%3CBR%20%2F%3E-%20User%20should%20employeeid.%3C%2FP%3E%3CP%3EMy%20syntax%20is%20below%3A%3C%2FP%3E%3CP%3E(user.objectId%20-ne%20null)%20and%20(user.userType%20-eq%20%22Member%22)%20and%20(user.DisplayName%20-notContains%20%22xyz%22)%20and%20(user.employeeId%20-ne%20null).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20know%20how%20to%20create%20Dynamic%20Distribution%20Group%20in%20exchange%2C%20but%20i%20am%20looking%20for%20above%20criteria%20how%20to%20create%20specific%20group%20as%20listed%20above%26nbsp%3Bin%20exchange%20office%20365%3F%3C%2FP%3E%3CP%3Eany%20help%20thx%20in%20advance%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1525357%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1525732%22%20slang%3D%22en-US%22%3ERe%3A%20create%20dynamic%20distribution%20group%20in%20exchange%20online%20office%20365%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1525732%22%20slang%3D%22en-US%22%3E%3CP%3EExchange%20doesn't%20deal%20with%20%22users%22%2C%20but%20with%20%22recipients%22%20-%20an%20object%20with%20an%20email%20address.%20Thus%20you%20cannot%20cover%20all%20users%2C%20only%20those%20with%20mailboxes%20or%20created%20as%20mail-enabled%20users.%20In%20addition%2C%20Exchange%20doesn't%20expose%20the%20employeeID%20attribute%2C%20so%20you%20cannot%20filter%20on%20that.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1525747%22%20slang%3D%22en-US%22%3ERe%3A%20create%20dynamic%20distribution%20group%20in%20exchange%20online%20office%20365%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1525747%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehow%20are%20about%20excluding%20account%20contains%26nbsp%3B%20specific%20word%20like%26nbsp%3B%20Guest%20%3D%20%3CA%20href%3D%22mailto%3AGuestMS%40CONTOSO%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EGuestMS%40CONTOSO.COM%20or%20PreviewGuest%40contoso.com%3F%3C%2FA%3E%3C%2FP%3E%3CP%3Eexclude%20any%20reciepient%20contains%20words%20guest%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1526819%22%20slang%3D%22en-US%22%3ERe%3A%20create%20dynamic%20distribution%20group%20in%20exchange%20online%20office%20365%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1526819%22%20slang%3D%22en-US%22%3E%3CP%3EGuests%20are%20actually%20valid%20recipients%2C%20you%20can%20exclude%20them%20via%20the%20recipienttype.%20Excluding%20based%20on%20(part%20of%20the)%20name%2Falias%20is%20also%20possible.%20This%20article%20lists%20(most%20of)%20the%20properties%20you%20can%20use%20for%20creating%20a%20filter%20for%20Dynamic%20DG%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fexchange%2Frecipientfilter-properties%3Fredirectedfrom%3DMSDN%26amp%3Bview%3Dexchange-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fexchange%2Frecipientfilter-properties%3Fredirectedfrom%3DMSDN%26amp%3Bview%3Dexchange-ps%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Folks,

I am able to create dynamic security group in azure as below requirements.

- with all users
- user type should be Member
- excludes displayname XYZ
- User should employeeid.

My syntax is below:

(user.objectId -ne null) and (user.userType -eq "Member") and (user.DisplayName -notContains "xyz") and (user.employeeId -ne null).

 

I know how to create Dynamic Distribution Group in exchange, but i am looking for above criteria how to create specific group as listed above in exchange office 365?

any help thx in advance

3 Replies

Exchange doesn't deal with "users", but with "recipients" - an object with an email address. Thus you cannot cover all users, only those with mailboxes or created as mail-enabled users. In addition, Exchange doesn't expose the employeeID attribute, so you cannot filter on that.

@Vasil Michev 

how are about excluding account contains  specific word like  Guest = GuestMS@CONTOSO.COM or PreviewGuest@contoso.com?

exclude any reciepient contains words guest?

Guests are actually valid recipients, you can exclude them via the recipienttype. Excluding based on (part of the) name/alias is also possible. This article lists (most of) the properties you can use for creating a filter for Dynamic DG: https://docs.microsoft.com/en-us/powershell/exchange/recipientfilter-properties?redirectedfrom=MSDN&...