With the release of Exchange 2007, even the most command line-phobic Exchange administrator will need to overcome his fears and dive head first into a world sometimes seemingly dominated by Unix and Linux gurus: The command line. Of course, most Windows administrators are familiar with command line usage, but the PowerShell-based Exchange Management Shell provides so much functionality that mastering this new tool will take quite some time and will probably result in some frustration.
In this, part 1 of 2 on this topic, let's talk about some of the terminology used by the Exchange Management Shell (EMS):
Also known as a "command-let," a cmdlet is nothing more than a command that you provide to the EMS. An EMS command is akin to commands that you would use at the normal Windows command line. For example, the commands "copy" and "dir" are used to perform file copies and to list the files and folders in a directory. Think of an ESM cmdlet and just one of these everyday commands. There are a few different kinds of cmdlets, including:
- Get: Retrieves information about a particular object. For example, the get-casmailboxcmdlet obtains information from Client Access server-based mailboxes and displays it on the screen.
- Set: Manipulates object information. For example, the set-casmailboxcmdlet allows you to change or configure parameters regarding mailboxes housed on Client Access servers.
In the Windows command shell, have you ever used the command "dir | more"? If so, you are already familiar with the concept of pipelining, which is also known as "piping." Piping is basically a means of taking the results of one command and sending them to another command for further processing. In our example, the contents of the directory are sent to the more command, which is responsible for showing you just a single page of information at a time, thus preventing a list of 3,000 files from just flashing before your eyes. The EMS provides the ability to support multiple levels of piping, so you can keep feeding ever more granular results into multiple commands for continued processing. Of course, your piping commands need to make sense. You wouldn't, for example, be able to pipe the results of get-casmailbox into the export-activesynclogcmdlet.
If having to learn a whole new command set and syntax wasn't enough to do, EMS also supports aliases, which allow you to use EMS capabilities without using the full name of the command or feature. EMS comes with dozens of built-in aliases, such as Epcsv, which is short for export-csv. You can also create your own aliases for commonly used commands.
Like most command shells, EMS commands accept parameters that dictate exactly what it is you want to accomplish. EMS includes a number of different types of parameters, including Boolean parameters. You'll see how different types of parameters work in examples later in this series. There are some special kinds of parameters that are incredibly useful that you should know about.
- Identity parameter: The Identity parameter allows you to directly manipulate a specific object by referring either to the object's unique GUID (Globally Unique Identifier) or the object's name.
- WhatIf parameter: This is an outstanding addition to any command line and, when used with cmdlets that support WhatIf, allows you to see exactly which objects will be affected by your command without actually affecting the objects. This is a great way to see if you have included the right parameters in your command so you don't accidentally, for example, delete every mailbox account on your server.
- Confirm parameter: With this parameter, you can run your command against a large set of results and individually decide whether to apply the command to a particular record.
In the next tip, you will learn about general command usage and piping and how to format command output.