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.

Working with services

Working with services

- [Instructor] Now just like the processes, we can use Get-Service. So I'm going to select this one to retrieve services. And so this will be a longer list, but you can recognize some of these. These will be the Windows update services and things like that, things that you would access within Services snap-in. Now we can do the same process as we've done with the processes, where we can go and retrieve a specific service or list of services, and sort them by their current status. So let's do Run Selection. And of course it comes back and says, oh, I don't actually have permission to do certain things. And that's actually just an issue with that specific service. But if I say allServices, you can see that I have them, and they are structured by their status. So we've got running and stopped. So you can see they're in order already. Now of course what we can do is combine that with our forEach-Object, and write those out if we need to as well. Now of course we can also filter by…

Contents