Dynamic Distribution Group with no Disabled Accounts

Copper Contributor



I'm trying to build a few Dynamic Distribution Lists in Exchange Online and want to only include Active Users (i.e., users that are marked "Active" in Azure AD). I've tried using the UserAccountControl attribute (-eq 514 or -ne 514 - both are returning the same results, which is strange), but it still includes user accounts that are disabled. This is how my recipient filter looks like:


      RecipientType -eq 'UserMailbox' -and UserAccountControl -ne 514


What's the best way to achieve this in Exchange Online?




Taranjeet Singh



1 Reply
Try this:

{RecipientType -eq "UserMailbox" -and ExchangeUserAccountControl -ne "AccountDisabled"}