While executing commands like Get-Mailbox, you often receive errors like identify is not found in default search scope. This you will see in a multi domain environment in general. In such cases, either you need to make the environment to look in whole forest for objects or ask powershell/cmdlet to ignore the scope.
Here are the two ways I am talking about…
Set the search scope to forest level :- to do this, execute the below command
$AdminSessionADSettings.ViewEntireForest = $true
Make cmdlet to ignore the scope:- to do this, pass -ignoredefaultscope argument to cmdlet
Get-Mailbox -IgnoreDefaultScope -Identity “cn=username,ou=ouname,dc=domainname,dc=com”
Note that, incase of ignore default scope, you should parse only DN to -identity parameter.
Let me know if you figureout some other way.