Exchange Shell and the missing child domain

Good morning.  Today I wanted to post a couple of quick one line PowerShell commands for Exchange 2010.  I used both of these today and they are invaluable in certain situations.

The first command is used to load local Exchange Shell.  Normally you don’t want to do this, but I had issues with RBAC (Role Based Access Control) that prevented doing anything in Exchange Shell or Exchange Management Console.

  1. Run a PowerShell command as Administrator
  2. Run: Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

 

The second command is very useful in multi-domain exchange forests.  For instance if multiple user accounts are in a child domain, but Exchange is in the parent domain, and you need to move the mailboxes.
Here is the command without setting the AD server setting parameter:
Get-Mailbox -Database “Mailbox Database” -Domaincontroller DC.child.domain.com | New-MoveRequest -TargetDatabase “New Database” -Domaincontroller DC.child.domain.com

Here is the command to change the behavior of Exchange Shell to mimic Exchange Management Console:
Set-AdServerSettings -ViewEntireForest $True

And the resulting command to move mailboxes as above:
Get-Mailbox -Database “Mailbox Database” | New-MoveRequest -TargetDatabase “New Database”

 

I hope you have found this article informative.  If you have any comments or suggestions, please leave them below.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s