Home > Exchange 2007, PowerShell > How to change default search scope in Exchange 2007

How to change default search scope in Exchange 2007

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.

No related content found.

Categories: Exchange 2007, PowerShell
  1. Mike
    January 4, 2011 at 9:47 pm | #1

    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.

  2. January 7, 2011 at 5:33 pm | #2

    Thanks Mike. That is a useful tip.

  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>