question

FnxQT-1261 avatar image
0 Votes"
FnxQT-1261 asked KyleXu-MSFT commented

Exchange Powershell : Is it possible to differentiate on prem and cloud based distribution group?

I'm trying to create a script that must count the number of cloud and on prem based distribution group in a hybrid Exchange setup (on-prem + office 365).

I already did that with the users mailbox, it's possible to differentiate them by using the RecipientTypeDetails attribute. A "UserMailBox" represents an on prem user and a "MailUser" represents a cloud user.

Is there something similar for distribution group ? I didn't find the answer.

I saw there were multiple attributes :

MailNonUniversalGroup
MailUniversalDistributionGroup
MailUniversalSecurityGroup

But I didn't find the differences between them.

Thank your for your help, regards

windows-server-powershelloffice-exchange-server-administrationoffice-exchange-hybrid-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KyleXu-MSFT avatar image
1 Vote"
KyleXu-MSFT answered KyleXu-MSFT commented

@FnxQT-1261

I think AndyDavid suggestion is correct:

If you synced all Exchange on-premises groups to Exchange online(Based on your description, I think you have synced all group). You need to create group on Exchange on-premises first, then you will could sync it to Exchange online. So, the synced group is created on Exchange online.


If you only sync a part of group to Exchange online, you will need to check from both Exchange on-premises and Exchange online:

Exchange on-premises created group:

 Get-DistributionGroup -ResultSize unlimited | Measure-Object

Exchange online created group:

 Get-DistributionGroup -ResultSize unlimited | where {$_.IsDirSynced -eq $False} | Measure-Object

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KyleXu-MSFT

Ok so IsDirSynced indicates whether the distributiongroup are wrote back to the onPrem exchange in case they were created online. That seems correct, thank you.


However, it made me doubtful about my method to check whether a user mailbox is onPrem or cloud based. For that (and the other types like Share, Room, Equipment Mailboxes) I'm using this method :

 Write-host "On Prem Users Count :" (Get-Recipient -Resultsize Unlimited -RecipientTypeDetails UserMailbox -DomainController $dc -WarningAction:SilentlyContinue).Count
     Write-host "Cloud Users Count :" (Get-Recipient -Resultsize Unlimited -RecipientTypeDetails RemoteUserMailbox -DomainController $dc -WarningAction:SilentlyContinue).Count
     Write-host "On Prem Shared Mailboxes Count :" (Get-Recipient -Resultsize Unlimited -RecipientTypeDetails SharedMailbox -DomainController $dc -WarningAction:SilentlyContinue).Count
     Write-host "Cloud Shared Mailboxes Count :" (Get-Recipient -Resultsize Unlimited -RecipientTypeDetails RemoteSharedMailbox -DomainController $dc -WarningAction:SilentlyContinue).Count

Does the "remote" prefix work to know whether these mailboxes are onPrem on Cloud based ?


Thank you.

0 Votes 0 ·

For user mailbox and shared mailbox, it is more complicated.

Mailbox hosted on Exchange online:

For migrated shared mailbox: RemoteRecipientType is ”Migrated, SharedMailbox“
For remote shared mailbox: RemoteRecipientType is "ProvisionMailbox, SharedMailbox"

For migrated user mailbox: RemoteRecipientType is "Migrated"
For remote user mailbox: RemoteRecipientType is "ProvisionMailbox"

Exchange on-premises mailbox:
User mailbox: RecipientTypeDetails: Usermailbox
Shared mailbox: RecipientTypeDetails SharedMailbox

1 Vote 1 ·

@FnxQT-1261
I am writing here to confirm with you any update about this thread now?
If the above suggestion helps, please be free to accept it as an answer for helping more people.

1 Vote 1 ·

Sorry, I was out of work until today. May I ask where you found the exact correlation between the type and whether they are onPrem / Cloud ? All I can found is https://answers.microsoft.com/en-us/msoffice/forum/all/recipient-type-values/7c2620e5-9870-48ba-b5c2-7772c739c651. Not that I do not trust you, but I would like to understand because I have to do it also for room, equipment and DL mailboxes.

In addition, how are we supposed to check the ”Migrated, SharedMailbox“ recipient type ? It seems that it's not possible using the get-recipient cmdlet. Are we supposed to parse the entire AD and compare the attribute AD:msExchRecipientTypeDetails on all items ? It seems very unoptimized.

Thank you a lot.


0 Votes 0 ·
Show more comments
AndyDavid avatar image
2 Votes"
AndyDavid answered FnxQT-1261 commented

Look for atttibute:
IsDirSynced

If True then its synced from on-prem

Assuming you are running this against Exchange Online Powershell:

 (Get-DistributionGroup -ResultSize unlimited |?{$_.IsDirSynced -eq $false}).count

 (Get-DistributionGroup -ResultSize unlimited |?{$_.IsDirSynced -eq $true}).count


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you, if I understood you well, with this command I could know if a DistributionGroup created onPrem is synced online. However, is it possible to check where the distribution group was created ?

For example to count how many users were created onPrem or in the cloud I use :

Write-host "On Prem Users Count :" (Get-Recipient -Resultsize Unlimited -RecipientType UserMailbox -DomainController $dc -WarningAction:SilentlyContinue).Count
Write-host "Cloud Users Count :" (Get-Recipient -Resultsize Unlimited -RecipientType MailUser -DomainController $dc -WarningAction:SilentlyContinue).Count

Since the user have different RecipientType I can differentiate them. Is something like that possible using your method or another ?

Thanks

0 Votes 0 ·
LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hi there,

In on-premise software, from implementation to the running of the solution, everything is done internally; whereby maintenance, safety, and updates also need to be taken care of in-house.
With no third-party involvement, you assume complete ownership.

Cloud computing is the delivery of on-demand computer system resources, requiring no active management, and usually includes applications such as storage and processing power.
With a cloud-based subscription model, there is no need to purchase any additional infrastructure or licenses

There are a few limits which apply to Office 365 distribution groups that you should be aware of:

Member count for a distribution list: 100,000 (50,000 for organizations using AAD Connect, 15,000 if there is a slightly outdated DirSync in place).
The number of groups created by a single user/admin: 300,000.



--If the reply is helpful, please Upvote and Accept it as an answer--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.