List all Office365 Groups and Distribution Lists that has a certain domain

Brass Contributor

Hi

 

We have Office365 and have multiple domains attached to it

 

We want to be able to run a script that lists all the Office365 groups and distribution lists that have this domain attached to it

 

Anyone know what command we need to run

 

Cheers

1 Reply

Easiest way is via the Get-AzureADDomainNameReference cmdlet:

 

Get-AzureADDomainNameReference -Name domain.com | ? {$_.ObjectType -eq "Group"}

 

The of course it depends on the definition of group, the definition of "attached to", and so on...