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.
If you modify the Exchange.ps1 file in %programfiles%microsoftexchange serverbin under “exchange variables” where it states “$global:AdminSessionADSettings.ViewEntireForest = $false” , modify the $false statement to be $true.
Each time powershell is launched from this point will pass the ps1 file to the program which will change the scope to forest level.
Thanks Mike. That is a useful tip.