The Exchange Management Shell is new to Exchange Server 2007. The basic idea behind the shell is that it is a command and scripting interface.
Figure 19: This is what the Exchange Management Shell looks like.
It may first appear as if the Exchange Management Shell is nothing more than a standard command prompt. But if you look at the bottom line of text in Figure 19, you will notice that the letters "MSH" appear in brackets just ahead of the path.
The [MSH] tells you that you are not running in a true command prompt environment, but rather within a Microsoft Scripting Host shell. The Exchange Management Shell is nothing more than a Microsoft Scripting Host environment that has been extended to support Exchange Server commands.
So what types of commands can you run within the Exchange Management Shell? Exchange Server 2007 has been designed so that anything that you can do through the GUI can also be done through the Exchange Management Shell.
The available commands and all of the things you can do with the Exchange Management Shell are almost endless -- and definitely beyond the scope of this tutorial. However, I do want to show you a couple of quick tricks you can perform with the Exchange Management Shell.
The first trick involves using the get-ExchangeServer command. If you type this command by itself, the Exchange Management Shell will attempt to display all of the server roles that are configured on the server. However, because of the way that the information is formatted, you'll be able to see very little of the actual information. But, if you append the |format-list option to the command, the Exchange Management Shell will display a very nice summary of how your server is configured.
Figure 20: Entering the get-ExchangeServer|format-list command.
Now let me show you an example of how the Exchange Management Shell can be used for scripting. As you have worked with the Exchange Management Console, you might have noticed that some rather bizarre commands are displayed after completing certain actions. For example, if you look at Figure 21, you will see the New Mailbox screen. To get the screen, I created a mailbox for a new user named "User3."
Figure 21: Many of the actions that you perform through the Exchange Management Console will reveal commands that can be used to perform the exact same action from a command prompt.
There's nothing especially remarkable about creating a new user account and a new mailbox (except that you can do it all through the Exchange Management Console now). However, if you look at Figure 21 again, you'll see an extremely long command following the mailbox creation. This is the actual command that you would enter into the Exchange Management Shell if you wanted to create the new user and the new mailbox from the command prompt.
OK, I know that nobody in the right mind would want to type such a long command when they can perform the action through the GUI. That isn't really the point though. I'm showing this to you because you can use this command -- or other commands revealed through the Exchange Management Console -- as the basis for a script.
Imagine for example that you had a couple thousand mailboxes to create. It would be a lot faster to create a script based on the command that I just showed you then it would be to manually create the mailboxes through the GUI.
STEP-BY-STEP GUIDE: TEST DRIVING EXCHANGE SERVER 2007
Part 1: Exchange Server 2007 installation requirements
Part 2: The test environment used for this Exchange Server 2007 tutorial
Part 3: The Exchange Server 2007 installation process
Part 4: Exchange Server 2007 post-deployment configuration tasks
Part 5: The Exchange Management Console for Exchange Server 2007
Part 6: The Exchange Management Shell for Exchange Server 2007
Part 7: The Outlook 2007 configuration process
Part 8: Favorite new Outlook 2007 features
Part 9: Related links on Exchange Server 2007
|ABOUT THE AUTHOR:|
| Brien M. Posey, MCSE
Brien M. Posey, MCSE, is a Microsoft Most Valuable Professional for his work with Exchange Server, and has previously received Microsoft's MVP award for Windows Server and Internet Information Server (IIS). Brien has served as CIO for a nationwide chain of hospitals and was once responsible for the Department of Information Management at Fort Knox. As a freelance technical writer, Brien has written for Microsoft, TechTarget, CNET, ZDNet, MSD2D, Relevant Technologies and other technology companies. You can visit Brien's personal Web site at http://www.brienposey.com.