Skip navigation

Windows PowerShell Transforms Exchange Server 2007 Management

Create the management framework your company needs

I used to be a GUI wimp, but now I’m a Windows PowerShell whiz: Such is the transformation many Exchange Server administrators will need to go through to thrive in the administrative landscape that Microsoft has created in Exchange Server 2007. Exchange 2007's Exchange Management Shell uses PowerShell commands to perform and automate common activities, such as moving mailboxes between servers. In fact, you can perform some actions, such as setting diagnostics logging, managing public folders, and changing parameters for the transport service, only through shell commands. (Microsoft says it will reintroduce GUI management for public folders in Exchange 2007 Service Pack 1—SP1.)

Let's begin looking at the PowerShell basics you need to run your Exchange environment. Future articles will delve into the details of how to extract the maximum benefit from PowerShell when managing Exchange 2007.

A New Management Philosophy
In previous versions of Exchange, administrators' management options were limited to whatever Microsoft provided—specifically, the Administrator program for Exchange Server 5.5 and earlier or Exchange System Manager (ESM) for Exchange 2000 Server and later. Administrators could always use registry hacks to change the way that Exchange components behaved, but in most cases you could manage Exchange only through the options presented in the GUI. If you wanted to create scripts to automate administrative tasks, you ran into a confusing mishmash of APIs, such as Collaboration Data Objects for Exchange Management (CDOEXM), Windows Management Instrumentation (WMI), and Exchange Routing Objects, none of which worked with more than one or two versions of Exchange.

Exchange 2007 delivers a completely different experience for administrators. You still have a management program that, like ESM, is built on the Microsoft Management Console (MMC) framework, but the new Exchange Management Console is organized to present options more efficiently, as Figure 1 shows. Microsoft’s goals for the new management console were to reduce the number of clicks required to get to useful information, such as the properties of a mailbox, and to group all management operations in one place instead of putting some in the MMC Active Directory Users and Computers snap-in and others in ESM. Exchange Management Console also bundles a set of utilities into a toolbox, where you’ll find options such as a revamped Message Tracking tool and an updated version of the Exchange Server Best Practices Analyzer. The new console takes a little getting used to, but overall it succeeds in delivering a more cohesive and effective management program for Exchange.

Exchange 2007 represents a radical cultural change in management philosophy. The GUI provides easy access to common management operations and you’ll use it a lot, but Exchange 2007 embraces PowerShell in a way that's awesome in its depth, coverage, and capabilities. You can now create the management framework that your organization needs instead of waiting for a Microsoft developer to do it for you. If you need to perform a task that Exchange Management Console doesn’t offer, you can be pretty sure that you can create the option yourself with a PowerShell command.

Into the Shell
PowerShell provides an excellent command set (with individual commands known as cmdlets) to manage standard Windows components. (For more information about cmdlets, see the Windows IT Pro article "Introducing Windows PowerShell," August 2006, InstantDoc ID 50565, and "Exchange 2007: Life Without ExMerge?" January 9, 2007, InstantDoc ID 94629.) For example, the following command lists the 10 processes that are consuming the most CPU resources on a server:

Get-Process | sort CPU –descending | select –first 10

Figure 2 shows sample output from this command.

The Exchange 2007 setup program installs Exchange Management Console and Exchange Management Shell, a snap-in for PowerShell. Installing Exchange 2007 adds over 360 Exchange-related commands to the standard PowerShell cmdlets through the Exchange Management Shell snap-in. Although you'll typically invoke the Exchange Management Shell from the Start menu, you can also load it by using the command

Add-PSsnapin Microsoft.Exchange.Management.Msh.Admin

To list the set of services that make up Exchange 2007, you can type

Get-Service *Exch* | Select DisplayName, Status

Figure 3 shows an edited version of the output from this command.

As you can see, PowerShell uses a consistent syntax that consists of a verb (e.g., Get, Set, Move, Disable) followed by a noun (e.g., Mailbox, User). Along with commands that operate on objects, you'll find commands that help you work with data, such as Where, Sort, Group, Import-CSV, and Export-CSV. You can type Help followed by a command name at any time to show the syntax of the command. To list all the commands available to work with a specific server role or type of component, type Get-Help followed by the role or component name:

Get-Help –Role *Mailbox*
Get-Help –Component *Recipient*

Showing its comprehensive nature, PowerShell includes the ability to invoke programs. For example, you can invoke Word, open a Word document named Exchange.doc, and count the number of words in the document with the commands

Invoke-Item c:\Temp\Exchange.doc
Type c:\temp\Exchange.doc | Measure-Object –Line –Word

Table 1 lists a few especially useful Exchange 2007 cmdlets.

The Exchange developers have done a nice job of providing extensive, accessible help for the Exchange Management Shell commands. Table 2 lists switches you can use with the Get-Help command when you need more information than the default command provides. You’ll probably start by using the –Full switch to get to know what a command does, then move on to the default view after you become accustomed to working with Exchange Management Shell. Remember that the Exchange 2007 Help file contains information about all the Exchange Management Shell commands.

Embrace the Shell
Exchange 2007 embraces PowerShell as a management tool—and so should you. In future articles, I'll help you become familiar with PowerShell and Exchange Management Shell and uncover the ways that these tools can make your job easier.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish