0%

0/1 Lessons

Course Introduction

• 5min

0 / 2 lessons complete

Getting Started with Windows PowerShell

• 56min

0 / 8 lessons complete

Getting Help and Finding Commands

• 39min

0 / 6 lessons complete

PowerShell Command Syntax

• 33min

0 / 5 lessons complete

PowerShell Objects and Properties

• 35min

0 / 6 lessons complete

The PowerShell Pipeline

• 24min

0 / 2 lessons complete

PowerShell Providers

• 30min

0 / 5 lessons complete

PowerShell Arrays and Variables

• 28min

0 / 4 lessons complete

PowerShell Loops

• 19min

0 / 3 lessons complete

PowerShell Conditional Statements

• 11min

0 / 1 lessons complete

On Premises Lab Setup

• 36min

0 / 8 lessons complete

Basic Domain Administration with Windows PowerShell

• 2hr 27min

0 / 10 lessons complete

Send Emails with PowerShell

• 22min

0 / 2 lessons complete

PowerShell Desired State Configuration (DSC) Basics

• 1hr 48min

0 / 6 lessons complete

PowerShell Modules

• 58min

0 / 7 lessons complete

Powershell Challenges

• 1hr 55min

0 / 23 lessons complete

Section Overview
Full Access Account Required

Video | 5 min

The Trusted Hosts List Challenge
Full Access Account Required

Text | 5 min

The Trusted Hosts List Answer
Full Access Account Required

Video | 5 min

Starting a Remote Session Challenge
Full Access Account Required

Text | 5 min

Starting a Remote Session Answer
Full Access Account Required

Video | 5 min

Rename a Computer Challenge
Full Access Account Required

Text | 5 min

Rename a Computer Answer
Full Access Account Required

Video | 5 min

Change a Password on a Remote Computer Challenge
Full Access Account Required

Text | 5 min

Change a Password on a Remote Computer Answer
Full Access Account Required

Video | 5 min

How to Copy Files To-From a Remote Machine Challenge
Full Access Account Required

Text | 5 min

How to Copy Files To-From a Remote Machine using VSC Answer
Full Access Account Required

Video | 5 min

How to Export Logs to a CSV File Challenge
Full Access Account Required

Text | 5 min

How to Export Logs to a CSV File Answer
Full Access Account Required

Video | 5 min

How to Create Multiple Folders on the Host Machine using Powershell
Full Access Account Required

Text | 5 min

How to Create Multiple Folders on the Host Machine using Powershell Answer
Full Access Account Required

Video | 5 min

Who Rebooted the Server ID1074 Challenge
Full Access Account Required

Text | 5 min

Who Rebooted the Server
Full Access Account Required

Video | 5 min

How can you get Info on all your Hard Drives Challenge
Full Access Account Required

Text | 5 min

How can you get Info on all your Hard Drives Answer
Full Access Account Required

Video | 5 min

How can I get a list of CPU's and Installed Printers, Last Boot-up Time Challenge
Full Access Account Required

Text | 5 min

How can I get a List of CPU's and Installed Printers, Last Boot-up Time Answer
Full Access Account Required

Video | 5 min

How can I Automate Tasks with Task Scheduler Challenge
Full Access Account Required

Text | 5 min

How can I Automate Tasks with the Task Scheduler Answer
Full Access Account Required

Video | 5 min

Course Conclusion

• 1min

0 / 1 lessons complete

The Pipeline Part 2

Instructions

Q&A (0)

Notes (0)

Resources (0)

Saving Progress...

Resources

There are no resources for this lesson.

Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.

Create note

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 get-member to get the property and methods of the object import-csv.
  • Command 2 will be New-Alias. We’ll us get-help â€“full to get the parameters that take byproperty.
  • Now we’ll open two PowerShell windows.
  • Type import-csv -path c:\test\aliases.csv | gm now press return

If you recall from our object’s lecture. Objects can have properties or methods. But what we’re interested in is properties and in this case Powershell displays them as noteProperty 

  • (NoteProperties are just generic properties that are created by Powershell)
  • Notice that Name and Value match the column headings from our csv file.

Now we need to use get-help to determine if Command 2 or in this case New-alias has a parameter that will bind with command 1 ByProperty

  • Type get-help new-alias -full press return
  • Scroll up until you see a parameter that says ByPropertyName
  • So, we see that the -Value and -Name parameters both accept pipeline input BypropertyName

These two commands should work because:

Command one which is import-csv passed two properties called name and value across the pipeline to the second command which is new-alias

From the second command new-alias Get-help told us that the parameters -name and -value can take pipeline input by propertyname

So, these command should work. We can test that by typing (press return)

Server Academy Members Only

Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.

0 0 votes
Lesson Rating
Subscribe
Notify of
profile avatar
0 Comments
Inline Feedbacks
View all comments