563699752 by Unknown

563699752 by Unknown

Author:Unknown
Language: eng
Format: epub


In the example the object of the Get-Service cmdlet is passed to the Format-Table cmdlet, which accepts this object collection. Henceforth, the output which is displayed as a table is sorted according to the Name and The collection of services available after executing this command is also passed to a variable. This is shown in the command sequence below:

$services = Get-Service

Format-Table -InputObject $services -Property Name, DependentServices

Internally, when PowerShell executes a pipeline, it enumerates any of the types that implement the IEnumerable interface. This interface sends members through the pipeline one-at-a-time.

Another common example is when the objects of the Get-Process cmdlet are piped into the Get-Member cmdlet, which displays the class type of the process objects, along with their methods and properties. This is shown in the example below:

Get-Process | Get-Member

In PowerShell, parameters are bound to the cmdlets using the parameter binding component, which uses specific criteria to achieve this purpose. The first criterion is that the parameter must accept input from a pipeline. The second criterion is that it should accept an object type that is sent or one that can be converted to an accepted type of object. The third criterion is that the parameter was not used as part of the command. A typical example that illustrates this concept is the Start-Service cmdlet, which has only two parameters that accept pipeline input. These parameters are InputObject and which take service objects and strings respectively.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.