Work with Output

After you've declared and set your variable or executed a specific cmdlet, you're likely to need to pass that information into another cmdlet or otherwise display the results to the console in some formatted fashion. In the following sections, we will review passing data between cmdlets and how to format the results in the console.

Understand the Object Pipeline and PipeBind Objects

Many scripting languages provide a mechanism to “pipe” output from one command to another. In the command prompt console, you can simply use the pipe operator (|) to pass information between commands as shown in this example that demonstrates how to find STSADM commands with the text user in them:

C:\>stsadm -help | find “user” add-ecsuserdefinedfunction ...

Get Automating Microsoft® SharePoint® 2010 Administration with Windows PowerShell® 2.0 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.