exchange powershell : get-mailbox outside default scope
-
03-07-2019 - |
Question
how do you run the cmdlet "get-mailbox" outside the current default scope of the current domain?
When I run get-mailbox -OrganizationalUnit bob.com/bobsage I get an error message saying: Get-mailbox: The requested search root 'rss.com/rsstoilet' is not in the current default scope 'ens.com'. Cannot perform searches outside the current default scope.
thanks in advance
Solution
Try to set this global variable:
$AdminSessionADSettings.ViewEntireForest = $True
Or use Set-ADServerSettings -ViewEntireForest $True
Or set it on a cmdlet level:
Get-Mailbox -IgnoreDefaultScope
OTHER TIPS
I'm pretty sure the error message is accurate - it cannot perform searches outside the current default scope. You would need to change the scope you're running the command in.
If you use the second option(-ignoredefaultscope), make sure to pass the DN of the object as a parameter to -Identity.
ex: Get-Mailbox -IgnoreDefaultScope -Identity "cn=username,ou=ouname,dc=domainname,dc=com"
Thanks, Sitaram Pamarthi