Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

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

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/24/2011 2:44:57 PM
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 construct 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.

The verbs used in both EMS and PowerShell are listed in Table 1. There is a high level of verb reuse to provide a consistent, predictable user experience. As in the English language, there are many more nouns than verbs. Examples of nouns used in EMS are mailbox, Mailboxserver, ExchangeServer, TransportSettings, DatabaseAvailabilityGroup, object, service, and so on.

Table 1. PowerShell and EMS Verbs
AddBackupInvoke
ClearCheckpointRegister
CloseCompareRequest
CopyCompressRestart
EnterConvertResume
ExitConvertFromStart
FindConvertToStop
FormatDismountSubmit
GetEditSuspend
HideExpandUninstall
JoinExportUnregister
LockGroupWait
MoveImportDebug
NewInitializeMeasure
OpenLimitPing
PopMergeRepair
PushMountResolve
RedoOutTest
RemovePublishTrace
RenameRestoreConnect
ResetSaveDisconnect
SearchSyncRead
SelectUnpublishReceive
SetUpdateSend
ShowApproveWrite
SkipAssertBlock
SplitCompleteGrant
StepConfirmProtect
SwitchDenyRevoke
UndoDisableUnblock
UnlockEnableUnprotect
WatchInstallUse

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 prompts 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 Dismount-Database and EMS prompts for the missing required parameters:

cmdlet Dismount-Database at command pipeline position 1
Supply values for the following parameters:
Identity: MBDB14

Confirm
Are you sure you want to perform this action?
Dismounting database "MBDB14". This may result in reduced availability for mail-
boxes in the database.
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y


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

Dismount-Database MBDB14

Getting Help with EMS

The Exchange Management Shell features a QuickRef 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 QuickRef at the EMS console on the Exchange server.

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 the 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 Server–specific cmdlets available 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 MBX1 | set-mailbox -MaxSendSize 5mb

The first part of the line, the part before the | pipeline operator, tells EMS to get all the mailbox objects on mailbox server MBX1. It then sends, or pipelines, the resulting set of objects to the next command, which instructs it to set the maximum send size of an email for these users to 5MB.

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 of objects is piped through the where-objectamy. The $_ variable equates to “this object.” The resulting set of objects, in turn, is piped through the set-Mailbox cmdlet to pass the parameter –MaxSendSize and set the value to 10MB. filter cmdlet that filters the mailbox objects to include only mailboxes with names beginning with

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 Switch and Confirm Parameter

There are times when the administrator writes a simple or complicated script in EMS and wonders what results it will produce. Some cmdlets support the –WhatIf–Confirm parameter. The –WhatIf switch informs the administrator what action the script would take if executed without the -WhatIf switch, and the –Confirm parameter prompts for confirmation before taking action. switch and

For example, suppose the administrator wants to set the Archive Warning Quota for all mailboxes in the Mailbox Store 5 database on server SERVER1. The administrator could use the following command:

Get-mailbox –database "SERVER1\Mailbox Store 5" | set-mailbox
–ArchiveWarningQuota 2GB

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

What if: Setting mailbox "companyabc.com/Admins/Keith Johnson"
What if: Setting mailbox "companyabc.com/Users/Jason Guillet"

This enables the administrator to easily see all the mailboxes that the set operation would be performed on 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 switch to execute the script.

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

Confirm
Are you sure you want to perform this action?
Setting mailbox "companyabc.com/Admins/Keith Johnson".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help
(default is "Y"):

Entering Y processes this operation, A processes all operations, N skips this operation, and L cancels further processing.

Other -----------------
- Using Windows PowerShell in an Exchange Server 2010 Environment : Starting the Exchange Management Shell
- Using Windows PowerShell in an Exchange Server 2010 Environment : Understanding the Exchange Server Task Model
- SharePoint 2010 : Creating Meeting Workspaces from Outlook 2007 and Outlook 2010
- Connecting SharePoint 2010 Content to Outlook 2010
- Using SharePoint Workspace with SharePoint 2010
- Coauthoring Word 2010 and PowerPoint 2010 Documents Stored in SharePoint 2010
- Exchange Server 2010 : Address List Configuration (part 2) - Working with Offline Address Books
- Exchange Server 2010 : Address List Configuration (part 1) - Creating and Configuring an Address List
- Windows Server 2008 R2 : Supporting Remote Desktop Services
- Windows Server 2008 R2 : Securing Remote Desktop Services
 
 
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
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server