Посмотреть запущенные службы windows в командной строке

Службы Windows (Windows Service) — приложения (программы), работающие в фоновом режиме, без пользовательского интерфейса. Грубо говоря, некий аналог демонов в Unix системах.

Управление работой служб с помощью консоли управления.

Для управления службами в Windows существует графическая утилита — службы (services.msc), для ее запуска необходимо перейти:

Панель управления (Control Panel) —> Администрирование (Administrative Tools) —>  Службы (Services) или в строке поиска меню Пуск (Start) ввести services.msc.

windows-services

Вид окна службы services.msc.

Из этой консоли можно просматривать, запускать, останавливать, изменять параметры и тип запуска служб.

Различные варианты запуска служб.

1) Автоматически (отложенный запуск) — служба будет запущена спустя некоторое время после старта операционной системы, используется для служб, ненужных при загрузке операционной системы, позволяет оптимизировать процесс загрузки.

2) Автоматически — служба будет запущена при старте операционной системы.

3) Вручную — служба запускается пользователем, приложениями или другими службами.

4) Отключена – службу  нельзя запустить.

Примечание: Существует еще один вариант (обязательная служба) — автоматически запускается и пользователь не может остановить эту службу).

Управление службами из командной строки.

Службами window можно управлять не только используя графическую утилиту, но и из командной строки windows cmd. Для запуска переходим в пункт меню: Пуск —> Выполнить —> В строку вводим команду cmd.exe. Ниже приведу команды для управления службами.

Остановка службы.

sc stop [имя_службы]

Запуск службы.

sc start [имя_службы]

Удаление службы.

sc delete [имя_службы]

Установка режима запуска службы:

sc config [имя_службы] start= [параметр_запуска]
	параметр_запуска:
		auto - автоматически.
		demand - вручную.
		disabled - отключена.
Примечание: После start= должен идти обязательно пробел.

Запрос данных конфигурации для службы.

sc qc [имя_службы]

Просмотр всех служб:

sc query

Для удобства чтения выводимой информации используем утилиту more.

sc query | more

Для копирования вывода в буфер используем утилиту clip.

sc query | clip

Вывод справки по команде sc.

sc ?

Примечание: Если имя службы содержит пробелы, то необходимо его заключить в кавычки.

sc delete “Events Utility”

Особенностью служб является то, что они запускаются от имени пользователя LocalSystem — обладающего полными правами в системе.

Список всех служб расположен в ветке реестра:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

На этом заканчиваем знакомство со службами windows. Надеюсь статья была полезная.

The services in Windows can be listed using the Service Manager tool.

To start the Service Manager GUI, press ⊞ Win keybutton to open the “Start” menu, type in services to search for the Service Manager and press Enter to launch it.

The services can also be listed using the command-line prompt (CMD) or the PowerShell.

In this note i am showing how to list the services and how to search for a specific service in Windows using the command-line prompt (CMD) or the PowerShell.

Cool Tip: List processes in Windows from the CMD! Read more →

List Services Using Command Line (CMD)

List all services:

C:\> sc queryex type=service state=all

List service names only:

C:\> sc queryex type=service state=all | find /i "SERVICE_NAME:"

Search for specific service:

C:\> sc queryex type=service state=all | find /i "SERVICE_NAME: myService"

Get the status of a specific service:

C:\> sc query myService

Get a list of the running services:

C:\> sc queryex type=service
- or -
C:\> sc queryex type=service state=active
-or -
C:\> net start

Get a list of the stopped services:

C:\> sc queryex type=service state=inactive

Cool Tip: Start/Stop a service in Windows from the CMD & PowerShell! Read more →

List all services:

PS C:\> Get-Service

Search for specific service:

PS C:\> Get-Service | Where-Object {$_.Name -like "*myService*"}

Get the status of a specific service:

PS C:\> Get-Service myService

Get a list of the running services:

PS C:\> Get-Service | Where-Object {$_.Status -eq "Running"}

Get a list of the stopped services:

PS C:\> Get-Service | Where-Object {$_.Status -eq "Stopped"}

Was it useful? Share this post with the world!

Как получить список запущенных служб в консоли Windows? — Очень просто.

Заходим Пуск — Выполнить — CMD. (Или вызвать командную строку любым другим способом). Набрать команду net start без параметров и система выдаст список запущенных на компьютере служб.

net start - Как получить список запущенных служб в консоли Windows

Вот и он.

How to block File Sharing for one or more IP Addresses in Windows

As you most likely already know, in Windows operating systems, a Windows service is a computer program that operates in the background, just like daemons in a Unix-like environment. They can be configured to either start when the operating system is started and run in the background as long as Windows is running, or started manually using the Service Manager tool, which can be launched by typing
services.msc  from the command prompt or by opening the start menu, typing «services» from the Start Menu and then launching the Service Manager icon that should show up right away.

In this post we’ll see some useful command-line prompt (CMD) and Powershell commands that can be used from most Windows environments (including Windows 10 and Windows Server) to list the installed / active / inactive services, as well as search for a specific service in Windows.

If you’re looking for a complete list of all the existing/available Windows Services, check out this post.

Command-Line (CMD) commands

How to list all Windows services:

sc queryex type=service state=all

How to list all Windows services (names only):

sc queryex type=service state=all | find /i «SERVICE_NAME:»

How to list all the running Windows services, excluding the stopped / inactive ones:

sc queryex type=service state=active

How to list all the stopped / inactive Windows services, excluding the running ones:

sc queryex type=service state=inactive

How to search for a given Windows service (by name):

sc queryex type=service state=all | find /i «SERVICE_NAME: MyServiceName»

How to retrieve the status of a given service (by name):

PowerShell commands

How to list all Windows services:

How to list all Windows services (names only):

sc queryex type=service state=all | find /i «SERVICE_NAME:»

How to list all the running Windows services, excluding the stopped / inactive ones:

Get-Service | WhereObject {$_.Status -eq «Running»}

How to list all the stopped / inactive Windows services, excluding the running ones:

Get-Service | WhereObject {$_.Status -eq «Stopped»}

How to search for a specific Windows service:

Get-Service | WhereObject {$_.Name -like «*MyServiceName*»}

How to retrieve the status of a given service (by name):

Get-Service MyServiceName*

Conclusions

We definitely hope that this post will help those system administrators that are looking for a quick and effective way to list, filter, search and/or retrieve the status of the Windows Services installed on their Windows machines using the command-line prompt (CMD) or Powershell.

Is there any Windows command which will show the status of a single service?

For example, I want to know whether «IIS admin service» is running or not. If it is running the command ouput should be «running».

I tried sc query type= service state= all | find "IIS Admin Service" which displayed the output:

«DISPLAY_NAME: IIS Admin Service»

I also tried net start "IIS Admin Service" | find "Running" which displays:

The requested service has already been started.

More help is available by typing NET HELPMSG 2182.

But it doesn’t give me an output such as

«service name» = running / disabled / stopped

Is there a command which has output in this format?

TRiG's user avatar

TRiG

1,1813 gold badges13 silver badges30 bronze badges

asked Feb 8, 2016 at 15:32

vikas's user avatar

Use the service name and not the display name

sc query iisadmin

jscott's user avatar

jscott

24.5k8 gold badges79 silver badges100 bronze badges

answered Feb 8, 2016 at 15:45

jonathan warren's user avatar

2

You can use Powershell thus:

Get-Service -name 'IIS Admin Service'

jscott's user avatar

jscott

24.5k8 gold badges79 silver badges100 bronze badges

answered Feb 8, 2016 at 15:48

vigilem's user avatar

vigilemvigilem

5792 silver badges7 bronze badges

This works fine:

sc query "service name" | FIND /C "RUNNING"

%ERRORLEVEL% is either 0 of the service is running, or 1 if it’s not. No need for 3rd party tools.

To catch the output of FIND you can use something like this:

sc query "service name" | FIND /C "RUNNING" >NUL && echo Service is running || echo Service is stopped

answered Jan 25 at 10:10

Antoine Megens's user avatar

If you’re willing to use the excellent Cygwin bash, you can simply write:

sc query "Bonjour Service" |grep -qo RUNNING && echo "Bonjour is ok!" || echo "Apple Bonjour Service not running"

The trick here is to have a proper grep available, so that in this way you can catch the true/false (success) status of command. Here -q is for silent and -o is for just returning the exact match and can probably be omitted. And yes, you need to put your «sc.exe» in your PATH.

answered Dec 18, 2017 at 7:57

not2qubit's user avatar

not2qubitnot2qubit

2811 gold badge3 silver badges10 bronze badges

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

  • Посмотреть кто использует порт windows
  • Посмотреть запущенные процессы windows в командной строке
  • Последняя версия windows 10 про
  • Посмотреть комплектующие моего пк windows 10
  • Посмотреть запущенные процессы windows cmd