Forum Discussion

Reza-rahman's avatar
Reza-rahman
Copper Contributor
Dec 18, 2023

Creating a "Managers" group in Azure

Hi

I asked my question in Microsoft community here but it still have a problem with that, I would like to create a Microsoft 365 group in Azure that contains every manager if:

 

  • The user's email address contains "@test.com".
  • The user's mailNickname does not contain a dot.
  • The user's account is enabled.
  • The user has one or more direct reports.

I created the below PowerShell command:

 

 

 

 

(user.mail -contains "@test.com") and (-not user.mailNickname -contains ".") and (user.accountEnabled -eq true) and (DirectReports -ne $null)

 

 

 

 

but it doesn't work and says: "Directreport' is not supported, what should I do?

Resources