Understanding the pipeline
The single most import ant concept in PowerShell is the use of its flexible, object-based pipeline. You may have used pipelines in UNIX-based shells, or when working with the cmd.exe
command prompt. The concept of pipelines is similar in that you are sending the output from one command to another. But, instead of passing plain text, PowerShell works with objects, and we can accomplish some very complex tasks in just a single line of code. In this recipe, you'll learn how to use pipelines to string together multiple commands and build powerful one-liners.
How to do it...
The following pipeline command would set the office location for every mailbox in the DB1
database:
Get-Mailbox -Database DB1 | Set-Mailbox -Office Headquarters ...
Get Microsoft Exchange 2010 PowerShell Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.