From the course: Complete Guide to PowerShell 7
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Sorting objects - PowerShell Tutorial
From the course: Complete Guide to PowerShell 7
Sorting objects
- [Instructor] Now another useful command is the sort-object, which allows us to sort things by specific properties. So if I get my list of processes, and of course when we render that, it comes back with this full list of properties that are available, and you can see one of those is CPU. So let's say I wanted to sort that by descending order. I can run that selection again. And sure enough, you'll see this number's the biggest. And then if we scroll all the way back up here, let me find that top of the list, this one, it'll then say my CPU is up here. So here's my most used. Now, we can also combine this with our select statements that we already had. So we can then say get process, pipe it to the sort object to put it in the right order, and then select the fields that we wish to show. So if we select that, you'll see, then it creates a different one. It comes back and says, okay, I've got the property of the CPU, I've got the name 'cause that's what we selected. I've put it in…
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)
-
-
-
-
-
-
-
-