Get-Mailbox not returning all Exchange Mailboxes

By default, Exchange PowerShell commands such as Get-Mailbox or Get-Recipient, are not returning all Exchange Mailboxes of the whole Active Directory Forest.

Moreover, they just return Mailboxes or Recipients located in the same Domain as the Exchange Organization.

The following command tells your current Exchange Management Shell session to return Mailboxes from the whole Forest:

1
Set-ADServerSettings -ViewEntireForest $true