From the course: Complete Guide to PowerShell 7
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Filtering objects - PowerShell Tutorial
From the course: Complete Guide to PowerShell 7
Filtering objects
- [Instructor] Now, of course, it's all good and well being able to retrieve an item and then sort an item, et cetera, but what we mostly want to do is actually filter the information then we come back. Rarely do we need to say, "Go and get me everything" and never do anything with it. We tend to retrieve data because we are trying to then filter the data and identify something else in that content. So, it's kind of what we do in a SQL database where you say, select everything from the table where something is, whatever. So, what we can do is we can use the Where-Object command. So, in the Where-Object command, we have a construct to the Where-Object. And then, we have this object called $_. $_ is effectively whatever the item is right now. So if I say Get -Service, it retrieves me an object which is a full array of data. And then the $_ is going to be the object that represents that specific thing. And then, the properties that are available are available from the $_. and the list…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Understanding PowerShell objects5m 6s
-
(Locked)
Inspect objects with Get-Member10m 55s
-
(Locked)
Select object properties5m 51s
-
(Locked)
Sorting objects3m 45s
-
(Locked)
Filtering objects4m 33s
-
(Locked)
Creating custom objects8m 27s
-
(Locked)
Extending objects with methods10m 26s
-
(Locked)
Converting objects to different formats9m 17s
-
(Locked)
-
-
-
-
-
-
-
-