Summary

Completed

In this module, you've learned how the Windows PowerShell command-line interface passes objects from one command to another in the pipeline. The following are the key takeaways:

  • When you connect two commands in the pipeline, pipeline parameter binding takes the output of the first command and decides what to do with it. The process selects one of the parameters of the second command to receive that output. Windows PowerShell has two techniques that it uses to make that decision. The first technique, which is the one that Windows PowerShell always tries to use first, is named ByValue. The second technique is named ByPropertyName, and it's used only when ByValue fails.
  • If you read the full Help for a command, you can see the pipeline input capability of each parameter, and a list of techniques the parameter supports.
  • When data is passed using ByValue, a parameter can accept complete objects from the pipeline when those objects are of the type that the parameter accepts. A single command can have more than one parameter accepting pipeline input ByValue, but each parameter must accept a different kind of object.
  • If Windows PowerShell is unable to bind pipeline input by using the ByValue technique, it tries to use the ByPropertyName technique. When Windows PowerShell uses the ByPropertyName technique, it attempts to match a property of the object passed to a parameter of the command to which the object was passed.
  • Like ByValue parameters, you can see the parameters that accept pipeline input by using the ByPropertyName technique and examining the full Help for the command.
  • Anytime you manually type a parameter for a command, you override any pipeline input that the parameter might have accepted. You don't force Windows PowerShell to select another parameter for pipeline parameter binding.
  • Another option for passing the results of one command to the parameters of another is by using parenthetical commands, which are commands that are enclosed in parentheses. The parentheses tell Windows PowerShell to execute the enclosed command first. The parenthetical command runs, and the results of the command are inserted in its place.
  • The –ExpandProperty parameter accepts one, and only one, property name. When you use that parameter, only the contents of the specified property are produced by Select-Object. Some people refer to this feature as extracting the property contents. The official description of the feature is expanding the property contents.