Exchange Server 2007 Management Shell
We look at how you can get the most from Exchange Server 2007's new command-line Management shell.
27 May 2007
Microsoft Exchange Server 2007 includes a new automation and scripting shell called the Exchange Management Shell. The Exchange Management Shell is a command-line management interface for administering servers in an Exchange 2007 organisation. The Exchange Management Shell is built on Microsoft Windows PowerShell technology, formerly codenamed Monad.
In most cases, administrators will perform simple non-repetitive tasks by using the Exchange Management Console and perform complex and repetitive tasks using Exchange Management Shell. However, some administrators may become so comfortable in the shell that they prefer to use it for most tasks; thus embracing Microsoft's continued movement towards total overlap of GUI/Wizard versus the command line.
Shell syntax
Each Exchange Management Shell (EMS) command uses a consistent syntax composed of a verb-noun combination and parameters. The verb-noun combination describes the action being performed and the parameters define exactly which object or attribute is being modified.
The following are some simple commands (to get you started) that run from within the EMS:
1: get-help (then enter) - help file
2: get-help about_* (then enter) - lists all Help topics starting with "about"
3: get-user (then enter) - Displays a list of users in Active Directory, showing those that do not have a mailbox.
4: get-excommand (then enter) - Displays a list of Exchange specific commands i.e Update-AddressList
5: get-help update-addresslist (then enter) - Displays help on addresslist update the -full parameter would display the complete help information for the Update-AddressList cmdlet
6: enable-mailuser -identity "UserNAME" -ExternalEmailAddress "UserNAME"@domainname (then enter) will configure the user as a mail-enabled user.
7: disable-mailuser -i "UserName" (then enter) and then Y for Yes to disable a mailbox account (the -identity field is shortened to -i, many parameters can be thus reduced)
8: get-user | sort-object name (then enter) -You can use this pipe command to redirect output from one command to another. In this case, the output of the get-user command is sorted based on name
9: get-user | where-object {$_.name -ilike "k*"} | sort-object name -In this case the output of the get-user command is filtered to include only names that begin with the letter "k" and are then sorted
10: get -distributiongroupmember finance | set-mailbox -MaxReceiveSize 1MB (then enter) - This command sets the maximum receive message size for all mail-enabled users in the finance distribution group to 1 MB
11: Type quickref at anytime to bring up the quickref.htm help HTTP Gui which displays a wealth of useful tips and tricks, eg:
Get-Command
This cmdlet retrieves all tasks that can be executed in Exchange Server 2007.
Get-Command *keyword*
This cmdlet retrieves tasks that have keyword in the cmdlet.
Get-task | Get-Member
This cmdlet retrieves all properties and methods of task.
Get-task | Format-List
This cmdlet displays the output of the query in a formatted list. You can pipe the output of any Get cmdlet to Format-List to view the whole set of properties that exist on the object returned by that command, or you can choose specific properties that you want to view, separated by commas, as in the following example: Get-Mailbox *john* | Format-List alias,*quota
Help task
This cmdlet retrieves Exchange Management Shell help information for any task in Exchange 2007, as in the following example: Help Get-Mailbox
Help task
Enter a partial name for task, and then press the TAB key to cycle through all cmdlets that contain the text that you specified. You can also use wildcard characters, as in the following example: Help *UM*
Get-task | Format-List > file.txtThis cmdlet exports the output of task to a text file: file.txt
The commands above effectively just scratch the surface of the immense power of this toolset.
In summary, the EMS is a very powerful command line ally to the exchange e-mail administrator or team and is a welcome addition to Exchange Server 2007 - as long as you get the syntax right of course!







