IT tutorials
 
Technology
 

Using the Windows PowerShell in an Exchange Server 2007 Environment : Understanding the EMS Syntax

10/21/2013 1:18:06 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

The Exchange Management Shell shares the same verb-noun syntax as PowerShell. This provides a consistent set of commands to learn and understand within the command environment.

Understanding the Verb-Noun Construct

EMS uses a strict verb-noun naming constraint for all of its cmdlets. The verb is separated from the noun with a hyphen. For example, the cmdlet get-mailbox returns all of the mailbox objects in the organization.

Common verbs include add, clear, disable, enable, export, get, import, move, new, remove, set, test, update, and write. As in the English language, there are many more nouns than verbs. There is a very high level of verb reuse to provide a consistent, predictable user experience. Examples of nouns used in EMS are mailbox, mailboxserver, ExchangeServer, TransportSettings, GlobalRule, object, service, and so on.

Walking Through Cmdlets in EMS

Some cmdlets offer many different switches and parameters. If administrators are not comfortable entering all the parameters for a cmdlet in one line, they can enter as much as they want, press Enter, and EMS will prompt for the rest. This provides an easy way to run cmdlets that are not often used and that don’t necessarily need to be saved for reuse.

For example, enter move-Mailbox and EMS prompts for the missing required parameters.

Cmdlet move-Mailbox at command pipeline position 1
Supply values for the following parameters:
TargetDatabase: Mailbox Store 2
Identity: Amy C. Guillet

This is the same as entering the following single line at the EMS command line:

Move-Mailbox "Amy C. Guillet" –Targetdatabase "Mailbox Store 2"

Getting Help with EMS

The Exchange Management Shell features a QuickStart guide that gives a quick tutorial on common commands and syntax. It provides common tasks and options, tips and tricks, recipient management examples, storage management examples, transport configuration examples, policy configuration, and server management examples. This is presented in a Hypertext Markup Language (HTML) page by simply typing Quickstart at the console.

The Exchange Management Shell includes two basic types of help—command help and conceptual help. Both types can be accessed from the console using the Get-Help cmdlet, which also uses the alias help.

To retrieve a list of all available help topics, simply type help *. To get help with a specific cmdlet, type help cmdlet-name. For example, help move-databasepath displays the purpose of the cmdlet, all required and optional parameters, return variables, and examples of its use.

By default, some information appears in the console window as one long, scrolling topic. To view the information a single page at a time, pipe the results to more. For example, Get-ExCommand | More displays all the Exchange-specific cmdlets in EMS, one page at a time.

Using Pipelining in EMS

Pipelining is the key to the power of EMS. It uses the output of one cmdlet to run through another cmdlet using the “|” (pipeline) operator. Pipelining provides bulk management changes. To understand this concept, examine this example:

Get-mailbox –server SERVER1 | move-mailbox -targetdatabase "UMSERVER\Mailbox Database 1"



The first part of the line, the part before the “|” operator, tells EMS to get all the mailbox objects on server SERVER1. It then sends, or pipes, the resulting set of objects to the next command, which instructs it to move them to Mailbox Database 1 on the server UMSERVER.

Another way of saying it is that one process output is consumed by another and another. Consider another example:

get-mailbox | where-object { $_.name -like "amy*" } | set-Mailbox -MaxSendSize 10mb


In this example, the get-mailbox cmdlet returns all the mailbox objects on all servers in the organization. This collection is piped through the where-object filter cmdlet that filters out the mailbox objects to only include mailboxes with names beginning with “amy.” The “$_” variable equates to “this object.” These objects, in turn, are piped through the set-Mailbox cmdlet to pass the parameter –MaxSendSize and set the value to 10Mb.

Note that EMS is not case sensitive and that it understands that 10MB equates to 10,240,000 bytes. In this example, the get-mailbox cmdlet produces a result, the where-object consumes it and produces another result, and this result is consumed by the set-mailbox cmdlet to set the new value.

Using the WhatIf and Confirm Parameters

There are times when the administrator will write a simple or complicated script in EMS and wonder what results it will produce. Some cmdlets support the –WhatIf–Confirm parameters. The –WhatIf parameter informs the administrator what action the script would take and the –Confirm parameter prompts for confirmation before taking action. and

For example, suppose the administrator wants to retire Mailbox Store 5 on SERVER1, and move all the existing mailboxes from the the current database to Mailbox Store 2 on UMSERVER. The administrator could use the following command:

Get-mailbox –database "SERVER1\Mailbox Store 5" | move-mailbox –targetDatabase "UMSERVER\Mailbox Store 2



By adding the –WhatIf parameter, the following result is output to the console for each mailbox:

What if: Performing operation "move-Mailbox" on Target "Move mailbox for:
Administrator ([email protected]) to Database: Mailbox Database
2,09014bc6-f977-4961-b4eb-8829fb13e5d6. The operation can take a long time and the
mailbox will be inaccessible until the move is complete".



This allows the administrator to easily see what operation would be performed by the script. If the results are as expected, the administrator presses the up arrow to recall the last typed line, and removes the –WhatIf parameter to execute the script.

If the administrator adds the –Confirm parameter, the following is output to the console:

Are you sure you want to perform this action?
Performing operation "move-Mailbox" on Target "Move mailbox for: Administrator
([email protected]) to Database: Mailbox Database 1,09014bc6-f977-4961-
b4eb-8829fb13e5d6. The operation can take a long time and the mailbox will be
inaccessible until the move is complete".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):



Entering “Y” processes this move, “A” processes all moves, “N” skips this move, “L” cancels further processing, and “S” suspends processing and returns the administrator to the console. Typing “exit” resumes processing.

 
Others
 
- Using the Windows PowerShell in an Exchange Server 2007 Environment : Common Uses of EMS , Explaining the Difference Between PowerShell and EMS
- Using the Windows PowerShell in an Exchange Server 2007 Environment : Understanding the Exchange Task Model
- Sharepoint 2013 : Developing Applications with Access (part 2) - The Access 2013 Client Application, Access 2013 Web Applications
- Sharepoint 2013 : Developing Applications with Access (part 1) - Exploring Access 2013
- Windows 8 : Troubleshooting Startup and Shutdown
- Windows 8 : Backing Up and Recovering a Computer (part 3) - Creating and Using File History
- Windows 8 : Backing Up and Recovering a Computer (part 2)
- Windows 8 : Backing Up and Recovering a Computer (part 1)
- Internet Explorer 8 Quick Tour (part 3) - Adding Sites to Your Favorites
- Internet Explorer 8 Quick Tour (part 2) - Browsing in Tabbed Pages
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us