Powershell - export list of all running services

Posted 19 April 2020 by Darren Welch

I have recently started using powershell to create scripts to automate mundane tasks. Within this guide, I will explain what commands you need to see running services on your machine & how to export them to a csv file.

 

Firstly,  you will need to open Powershell.

 

We will use the get-service command.

 

Type:

get-service 

and hit return.  This will return a list of all services running on your machine.

 

To filter this down to just 'running' services.  We would type:

 

get-service | 
where-Object Status -eq 'running'

 

If you would like to change the columns returned you can use the select-object command:

get-service | 
where-Object Status -eq 'running' |
select-object DisplayName, Status

If we want to export these results into a csv file, first we need to set a location (to save the file) then use the export-csv command

set-location -path c:\exports
get-service | 
where-Object Status -eq 'running' |
select-object DisplayName, Status |
export-csv .\running-services.csv

If your scripts are very long, you could always assign it to a variable and export it later e.g.

$services = get-service | 
where-Object Status -eq 'running' |
select-object DisplayName, Status

$services | export-csv .\running-services.csv




Darren Welch

By

Darren Welch


  19 April 2020


Contact me online

Advertisment


Tags


coding programming computing powershell

Has this helped?


If this has saved you time and you are feeling generous, why not buy me a coffee.

Thank You cup of coffee

Related Content




How to create templates using HTML, JSON & Jquery

20 Jun 2018




Bat and ball game built with HTML & JS

03 May 2018




How to write HTML faster using Zen Coding

16 Apr 2018