Command Line-based Exchange Management using ExchMbx


During the development of Microsoft Windows 2003 Server one of the Windows Server development team design goals was to provide a Command Line Interface (CLI) variant for each task possible via the Graphical User Interface (GUI) and I must say they almost reached their goal. For example any task (AD user object manipulation, DNS management etc.) that can be done via the different Active Directory (AD) related Microsoft Management Consoles (MMCs) can be done through the CLI as well.


But when it comes to command line management there is one thing we have missed for a long time, and that’s the possibility of, during Exchange related tasks, such as mailbox-enabling/disabling AD users and group objects, mail-enabling Contact objects, moving mailboxes between different mailbox stores and storage groups and so on. Unfortunately Exchange 2000 and 2003 lacks a command line driven management interface, but bear in mind the next version of Exchange which is known as Exchange 12 will ship with the MONAD Shell (MSH) which will provide full support for Exchange command line management tasks. You can read more about MONAD (MSH) by reading the following transcript of a Microsoft Chat which discussed MONAD (MSH):



http://www.microsoft.com/technet/community/chats/trans/windowsnet/wnet_120704.mspx


But what do we do until Exchange 12 is released (scheduled for the second half of 2006)? We use a neat little tool called ExchMbx created by Joe Richards (Windows Server Directory Services MVP) who is the man behind Joeware.net, and developer of other respected tools such as ADFind (ExchMbx can actually be combined with ADFind which makes it even more powerful) and ADMod. You can grab a copy of ExchMbx by clicking the Download Now button on this site.


ExchMbx Requirements


ExchMbx needs to be run on a Windows 2000, Windows XP or Windows 2003 Server; in addition the machine needs to have the Exchange System Manager tools installed.


Using ExchMbx


I won’t go into details about each switch/option included in ExchMbx (instead run ExchMbx with /? or visit this site for further information), this article has been written to whet your appetite and show you how powerful the tool actually is. It’s then your job to experiment with the tool yourself (I strongly advise you do this in your test lab before starting to manipulate AD objects in your production environment!).



Warning!
As Joe also informs on the website of ExchMbx, the tool should be considered dangerous, it can quickly make some serious changes to your directory. Use the tool only when you know what you are doing. I take no responsibility for you dorking up your directory.


Below I’ll show you three examples of how you can do Exchange command line management on AD objects using ExchMbx.


Mailbox-enabling an AD user object


In the first example I’ll show you how to mailbox-enable an already existing AD user object. As you can see we’re mailbox-enabling an AD user named Testuser01 located in an Organizational Unit (OU) named Users, which again is located under another OU called Hosted. The user belongs to an AD domain named Exchangeadmin.dk (DC=Exchangeadmin,DC=dk), and we’re creating the mailbox in Mailbox Store (EADKS05) placed under the First Storage Group on the Exchange Server EADKS05 (see Figure 1). The mailbox is created with the –cr switch/option.



C:\ExchMbx>exchmbx -b “CN=Testuser01,OU=Users,OU=Hosted,DC=Exchangeadmin,DC=dk”
-cr Eadks05:”First Storage Group:Mailbox Store (EADKS05)”




Figure 1: Mailbox-enabling an AD User Object Using ExchMbx


Moving a Mailbox


Secondly I will show you how to move a mailbox from one mailbox store to another. As you saw above we created the mailbox in Mailbox Store (EADKS05), below we’ll then move it to another Mailbox Store called Mailbox Store 2 (EADKS05) as you can see in Figure 2. The mailbox is moved with the –move switch/option.



C:\ExchMbx> exchmbx -b “CN=Testuser01,OU=Users,OU=Hosted,DC=Exchangeadmin,DC=dk”
-move Eadks05:”First Storage Group:Mailbox Store 2 (EADKS05)”




Figure 2: Moving a Mailbox Using ExchMbx


Mailbox-disabling an AD user object


Last but certainly not least I’ll show you how to mailbox-disable an AD user object. There’s not that much to say about this procedure, you simply specify the AD user object followed by the –clear switch/option (see Figure 3)



Note:
Even though you delete the mailbox it’s not really deleted, it would be more appropriate to say it’s been disconnected from the respective AD user object. Nothing stops you from reconnecting it to another AD user object if you like.


C:\ExchMbx\ExchMbx>exchmbx -b “CN=Testuser01,OU=Users,OU=Hosted,DC=Exchangeadmin,DC=dk”
-clear




Figure 3: Mailbox-disabling an AD User Object Using ExchMbx


We have only touched the surface of ExchMbx, meaning the above examples are very basic, for example you can also use ExchMbx in combination with ADFind or with a text file listing the AD objects you wish to manipulate.


I hope you found the article inspiring and useful.

About The Author

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top