By now most of you should be familiar with what Monad (aka MSH) is. For those who still don’t know, I can tell you Monad is Microsoft’s next-generation interactive command-line and scripting language for Windows. Monad gives you, as the System Administrator, a totally new and exciting way to perform a wide range of administrative tasks. Monad relies on the .NET Framework (version 2.0 which you can download here).
Monad or MSH currently supports Windows XP SP2, Windows Server 2003 SP1 and Windows Vista, but Microsoft’s intention is to build all future products on top of so-called Monad cmdlets (pronounced commandlets). The first major Microsoft product to take advantage of the Monad scripting language is, as some of you probably already know, the upcoming version of Exchange which at the time of this writing is known as Exchange 12 (E12), which is expected to RTM in Q1 2007.
The Exchange Management Shell
The new Exchange Management Shell in Exchange 12 makes it possible for you as an Exchange administrator to manage all types of Exchange tasks such as mail-enabling users, move mailbox stores between storage groups, configure the forms-based authentication page used by OWA, configure SMTP connectors through the Management Shell instead of through the sometimes rather awkward Exchange System Manager (which in Exchange 12 is called the Exchange Management Console). Actually all tasks (plus additional tasks) that can be performed via the GUI can be performed via the Management Shell as well.
In addition to the above mentioned tasks the Exchange Management Shell also provides a very robust as well as flexible scripting platform, which means you no longer need to play with long complicated Visual Basic scripts etc. in order to get a script that performs a specific task. The Exchange Management Shell will do this for you, typically only with a few lines of code. Some of you may think the Exchange commands must be very difficult and complex, but actually this is not the case. If you have ever played with PERL, either in a UNIX or Windows environment, or a similar scripting language, I can tell you the Monad language is much easier to understand (as you’ll see in the examples section of this article).
Exchange Management Shell Examples
One cool thing I wanted to mention before we start looking at a few cmdlet examples is that the Exchange Management Shell includes a “Tip of the day” feature just like is the case with most UNIX languages. This means that every time we start the Exchange Management Shell (or simply by typing get-tip or tip) we get a tip similar to the one shown in Figure 1 below.
Figure 1: Exchange Management Shell – “Tip of the day”
As you can see in the figure above you can also type get-excommand in order to get all Exchange related cmdlets listed. This is a great feature if you forget a command or just want to see which cmdlets are available. You can also get help about a particular cmdlet by typing help cmdlet-name or cmdlet-name ?. If we, for example, need help with the move-mailbox cmdlet, we type help enable-mailbox or enable-mailbox -? This will provide us with the information shown in Figure 2 below.
Figure 2: Exchange Management Shell – Enable-mailbox cmdlet
Okay it’s time to show you a few cmdlets in action.
Moving a Mailbox
Let’s start out with moving a mailbox from one mailbox store to another. To do this you simply type move-mailbox. You will then be asked to provide the name of the target database as well as the user alias or name. You can also provide this information immediately by typing move-mailbox hew –targetdatabase “mailbox store 2”.
Figure 3: Exchange Management Shell – Moving a mailbox cmdlet
Figure 4: Exchange Management Shell – Moved Mailbox Status
List mail-enabled users, mailbox stores or storage groups
To list all mail-enabled users you would simply need to type get-mailbox (see Figure 5). Similarly to list all mailbox stores or storage groups you would just have to type get-mailboxdatabase (see Figure 6) and get-storagegroup (see Figure 7) respectively. You can of course use additional parameters so that only particular mailboxes, mailbox stores or storage groups are listed; sorted based on size, date of creating, naming standard etc.
Figure 5: Exchange Management Shell – Get-mailbox
Figure 6: Exchange Management Shell – Get-mailboxdatabase
Figure 7: Exchange Management Shell – Get-storagegroup
Mounting and Dismounting Mailbox Stores
To mount or dismount a particular mailbox store, you simply type (alright you probably guessed it and you’re so right) the cmdlet for this is simply mount-database “mailbox store name” and dismount-database “mailbox store name”. Again you would of course be able to mount or dismount multiple mailbox stores etc. by specifying additional parameters.
List Email address policies
Okay let’s take one last example. To list all email address policies in the Exchange organization you type get-emailaddresspolicy (see Figure 8). If you have multiple policies you could also filter, list them etc. as required.
Figure 8: Exchange Management Shell – Get-emailaddresspolicies
The above examples should give you an idea of how easy it will be to administer Exchange 12 by using the Exchange Management Shell. Of course these were only simple examples, but you can do quite complex configurations as well. I’ll show you this in future articles here on MSExchange.org, until then have fun.
After reading this article it should come as no surprise Monad is required learning when it comes to Exchange 12 as well as other Microsoft applications such as Longhorn, Vista, etc. I’ve therefore listed a few links that should get you started.
Windows “Monad” Shell Beta 3.1 (for .NET Framework 2.0 RTM) x86:
The MS Monad Blog:
Scripting with the Windows “Monad” Shell:
TechNet Webcast: Next Generation Command Line Scripting with Monad (Part 1 of 2) (Level 300)
TechNet Webcast: Next Generation Command Line Scripting with Monad (Part 2 of 2) (Level 300)