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.

Managing processes with Get-Process

Managing processes with Get-Process - PowerShell Tutorial

From the course: Complete Guide to PowerShell 7

Managing processes with Get-Process

- [Instructor] So how do we manage processes? Well first off, this is all based around using the Get-Process. So here we're going to grab the processes and sort them by CPU. So I'm going to say Run Selection. And then what that does, that populates my variable. And sure enough, if we scroll you can see that it's sorted by CPU usage and it structures it that way. Now what we can do is we could actually go ahead and loop each of those objects and do some math equations. So you can see we've taken the process, getting the name, the ID, the CPU, and then we're doing some calculation around the memory to get the right amount. So let me just do Run Selection here and it's going to keep going. We'll leave that scrolling for a second. But you can see it's done the calculation and it outputs it in a better format than we had before. But utilizing Get-Process just means we can retrieve the list of processes and then of course combining that with Sort-Object means that we can sort them in a…

Contents