PowerShell Basics
Chapter 3 of 18
Chapter 3: Think in Objects, Not Text
This chapter covers the ideas that PowerShell is built on. You will learn how to store values, how to hold a list of values, and how objects move from one command to the next. You will also learn how to look inside an object, build your own object, and filter at the source when you can. These ideas may feel new at first, and that is normal. By the end, you will be able to read a short pipeline, explain what each part does, and shape a result into the form you need.
7 lessons 3 learning objectives 3 diagrams 3 related commands
Topics at a glance: Variables, Arrays, The pipeline and parameter binding, Other command chaining, Objects, Custom objects, The Filter parameter.
Where this chapter fits
This chapter comes after Chapter 2: Your First PowerShell Commands in the journey, so ideas from that chapter will feel familiar here.
After this chapter comes Chapter 4: Everyday Commands That Save Hours.
Learning objectives
By the end of this chapter, you will be able to:
- Store and combine values in variables and arrays
- Pass objects through the pipeline and explain parameter binding
- Inspect objects, build custom objects, and use the Filter parameter well
Lessons in this chapter
Work through the lessons in order. Each lesson page has explanations, examples, common mistakes, and a knowledge check.
Lesson 1: Variables
A variable is a named box that holds a value. PowerShell variables start with a dollar sign, and they can hold text, numbers, dates, or whole objects.
3 things to learn in this lesson
Lesson 2: Arrays
An array holds a list of values in one variable. You can count them, read one by position, and process each one in turn.
3 things to learn in this lesson
Lesson 3: The pipeline and parameter binding
The pipe character sends objects from one command to the next. Parameter binding is how PowerShell decides which input goes to which parameter.
3 things to learn in this lesson
Lesson 4: Other command chaining
Besides the pipe, PowerShell can run commands one after another, or run the next command only when the first one succeeds or fails.
3 things to learn in this lesson
Lesson 5: Objects
An object is a structured value with properties and methods. Learning to inspect an object is the skill that makes the rest of PowerShell make sense.
3 things to learn in this lesson
Lesson 6: Custom objects
A custom object is an object you build yourself, with the properties you choose. It is the clean way to shape a result for a report or for the next step.
3 things to learn in this lesson
Lesson 7: The Filter parameter
The Filter parameter asks the source to do the filtering, before results reach PowerShell. It is often faster than filtering afterwards, but its syntax is not the same as Where-Object.
3 things to learn in this lesson
Diagrams in this chapter
These diagrams come from lessons in this chapter. Tap a stage in a diagram to see what it does.
Variables (from the lesson: Variables)
Choose a stage above to see what it does.
Pipeline flow (from the lesson: The pipeline and parameter binding)
Choose a stage above to see what it does.
Objects and their properties (from the lesson: Objects)
Choose a stage above to see what it does.
Related command references
These command pages are linked to lessons in this chapter. Each command page has its syntax, parameters, and examples.
Get-Variable
Lists variables in the session, or one named variable.
From the lesson: Variables
Set-Variable
Creates or changes a variable, with options such as read only.
From the lesson: Variables
Get-Member
Lists the properties and methods of objects.
From the lesson: Objects
Tip: read the lesson first, then use the command page as a quick reference.