Collections:
Other Resources:
Cmdlet Pipeline Patterns in Windows PowerShell
Are there any usage patterns for cmdlet pipelines in Windows PowerShell?
✍: FYIcenter.com
Yes, there are some usage patterns for cmdlet pipelines in Windows PowerShell.
1. Use cmdlets of the same noun in a single pipeline - This is to ensure that we are working on the same object type in the entire pipeline.
For example, there are 5 cmdlets with the noun of "Process": Get-Process, Start-Process, Stop-Process, Wait-Process and Debug-Process. They are perfectly designed to be used in a single pipeline.
2. Start a pipeline with a Get-* cmdlet - A Get-* cmdlet is usually designed to be used as the first cmdlet with no input object. It generates an output object for the next cmdlet.
For example, Get-Date cmdlet by default takes no input object and generates a DateTime object represents the current date and time.
3. Use a Format-* cmdlet to end a pipeline - A Format-* cmdlet is designed to accept any type of object. It will extract information out of the input object and display it according to the specified format.
For example, "... | Format-Table" will try to extract information from whatever it receives and display it in a text table format.
4. Use object utility cmdlet anywhere in a pipeline - Windows PowerShell offers several object utility cmdlets: Get-Member, Where-Object, Sort-Object, Group-Object, and Measure-Object. They are designed to take any types of objects, manipulate or convert them, and returns new objects.
For example, "... | Where-Object <condition> | ..." will take a list of objects, apply the specified search condition, and return a list of matched objects.
⇒ Cmdlet Output Object List in Windows PowerShell
⇐ Object Type Match in Pipeline in Windows PowerShell
2016-11-04, 2208🔥, 0💬
Popular Posts:
Extracting All Files from a ZIP File 1. Run WinZIP and select menu File > Open Archive. The "Open Ar...
Where are Apache server log files located? If you have followed our Apache Server Installation tutor...
What is Java Runtime Environment 1.4.2 - Download Program Files (DPF)? Java Runtime Environment 1.4....
What files are stored in the "C:\Users\<userid >\AppData\Local\M icrosoft\Windows\Tempor. ..
How to install Windows 7 Service Pack 1 (SP1)? I have the SP1 file downloaded. If you have the Windo...