The Pipeline Part 2
As you already know pipeline parameter binding is the method of stringing together the right cmdlets to perform a task.
Byvalue or Byproperty is the glue that PowerShell uses to allow the output of one command to pass to the input of the second command
In the last lecture we demonstrated how to get commands through the pipeline **Byvalue. **
In this lecture, we’ll demonstrate how PowerShell uses parameter binding byproperty.
We’ll introduce two new commands:
- import-csv and the** new-alias** command.
- The Import-Csv cmdlet creates table-like custom objects from the items in
CSV files. Each **column **in the CSV file becomes a **property **of the custom
object and the items in rows become the property values
- The New-Alias cmdlet creates a new alias in the current PowerShell session.
let’s Open windows explorer. From your c: drive create a folder named test. Close explorer
Now we’ll use notepad to create a csv (Comma separated value) file and copy that to our test folder.
- From the search bar type notepad.
- Now type the following:
Name, Value
L, eventlog
List, get-childitem
P, ping
W, winver
Now from file, click save-as. Click the C: drive and click the test folder.
For a file name type aliases.csv
Change save as type , press the down arrow and change .txt to **All Files. **
Now click save., then click close.
Now, the parameter binding process that PowerShell uses to determine what commands pass through the pipeline is basically the same for byproperty and for byvalue, with a few differences.
For command #1 you still use get-member and for command #2 you still use get-help. The difference is that now you are looking for things that are byproperty instead of byvalue.
- Command 1 which in this case is import-csv. We’ll use **ge…
No comments yet. Add the first comment to start the discussion.