Статус службы windows cmd

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!

In Windows, many services essential for the operation of the system and applications run in the background. Checking the status of these services is important for system administration and troubleshooting. While there are methods to check service status using the GUI, checking directly from the Command Prompt allows for quicker access to information. This article provides a detailed explanation on how to check the status of services using the Windows Command Prompt.

TOC

Commands to Check Service Status

To check the status of services from the Windows Command Prompt, you can use the sc command or the net start command. These commands are part of the command-line tools built into Windows and are used for service management.

Using the `sc` Command

The sc command is used to display or change the configuration and status of services. The basic command to check the status of a service is as follows:

The service name specifies the actual name of the service. For example, to check the status of the Windows Update service, you would use the following command:

Executing this command displays details about the service, such as its name, display name, status (e.g., RUNNING, STOPPED), and service-specific error codes.

Using the `net start` Command

The net start command is used to display a list of currently running services. Instead of directly checking the status of a specific service, it lists all services that are currently running.

Executing this command will display a list of all services that are currently running on the system. If a specific service is included in the list, it is running. If it is not included, the service is either stopped or not started.

By utilizing these commands, you can efficiently manage Windows services from the command line.

Commonly Used Service Status Check Commands

When managing or troubleshooting Windows, you may frequently need to check the status of specific services. Below are examples of commands for checking the status of commonly used services.

Windows Update Service (wuauserv)

The Windows Update service manages updates for Windows. To check the status of this service, use the following command:

Remote Desktop Service (TermService)

This service is used for accessing other computers using Remote Desktop. To check the status of this service, execute the following command:

Print Spooler Service (Spooler)

The Print Spooler service manages print jobs and sends them to the printer. To check this service, use the following command:

DHCP Client Service (Dhcp)

The DHCP service provides the function of automatically assigning IP addresses on the network. The command to check the status of this service is as follows:

Windows Firewall Service (MpsSvc)

The Windows Firewall is a service that protects the computer from unauthorized access. To check the status of this service, enter the following:

These commands allow you to easily check whether a specific service is currently running or stopped. Depending on the state of the service, appropriate actions or configuration changes can be made.

Commands to Start and Stop Services

Using the Windows Command Prompt to start or stop services is one of the basic operations in system administration. Below, we introduce commands for effectively managing services.

Commands to Start a Service

To start a service, use the net start command or the sc start command. You can specify the service name to start a particular service.

Or

For example, to start the Remote Desktop service, you would do the following:

Or

Commands to Stop a Service

To stop a service, use the net stop command or the sc stop command. You can specify the service name to stop a particular service.

Or

For example, to stop the Print Spooler service, use the following command:

Or

Commands to Restart a Service

If you need to restart a service, execute the commands to stop and then start the service in sequence. This is often necessary to apply configuration changes or solve problems.

net stop [Service Name] && net start [Service Name]

Or

sc stop [Service Name] && sc start [Service Name]

Proper use of these commandsallows for efficient system management and troubleshooting of Windows systems.

Examples of Troubleshooting with Command Prompt

This section describes common troubleshooting scenarios you might encounter while operating Windows and how you can use the Command Prompt to resolve them.

Troubleshooting a Non-Working Printer

If a printer in Windows is not working as expected, checking and, if necessary, restarting the Print Spooler service can resolve the issue.

  1. Check the status of the Print Spooler service: sc query Spooler. If the status is not “RUNNING,” the service may be stopped.
  2. Restart the Print Spooler service:
    net stop Spooler && net start Spooler
    This command stops and then restarts the Print Spooler service, which can resolve temporary issues related to the printer.

Solving Internet Connection Issues

If there are issues with the internet connection, checking and restarting the DHCP Client service to attempt reassignment of the IP address can be effective.

  1. Check the status of the DHCP Client service: sc query Dhcp. If the service is stopped, it may not be assigning IP addresses correctly.
  2. Restart the DHCP Client service:
    net stop Dhcp && net start Dhcp
    This action can prompt the system to acquire a new IP address from the DHCP server, potentially resolving connection issues.

Conclusion

Using the Command Prompt to manage Windows services is a powerful skill for system administrators and advanced users. Understanding how to check the status, start, stop, and restart services enables quick resolution of many common issues. The commands introduced in this article serve as a foundation for operating and troubleshooting Windows, and can greatly aid in efficient system management. Make use of these commands to enhance your system administration capabilities.

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.

Manage
Learn to apply best practices and optimize your operations.

Top Windows command-line commands

Source: 
iStock/RUSSELLTATEdotCOM

Visual Editor: Sarah Evans/TechTarget

Anytime you want to know what services are installed on a computer and find out which ones are active, you can use sc query state= all to find a complete list. If the computer in question is remote, you should use sc \\computername query state= all.

If you’re looking for a specific service, you can use sc query service_name. To find the configuration information for a specific service, you can use sc qc service_name. To stop a particular service from running on a computer, use sc \\computername stop service_name. And if you have to start a service on a computer, you can use sc \\computername start service_name.

Another query command that can come in handy if, for example, you have to see the results of a security audit is auditpol /get /category:*.With this command, you can ask for and establish audit settings on a local computer.  To see the same results in CSV format you can use auditpol /get /category:* /r.

View All Photo Stories


Search Virtual Desktop


  • Running GPU passthrough for a virtual desktop with Hyper-V

    IT needs to deliver quality to UX for desktops users, and sometimes edge cases arise. For example, they might need to configure …


  • How to troubleshoot an RDP remote session stuck at configuring

    Admins forced to troubleshoot a Microsoft RDP session stuck at configuration must understand these key steps to fix their issue …


  • How to create and manage Azure Virtual Desktop golden images

    With the help of golden images, virtual desktop administrators can deliver a secure and up-to-date system with all that end users…

SearchWindows Server


  • Try these strategies to modernize Windows workloads

    Legacy applications create tough choices for admins who must balance business needs and security. This article covers these …


  • Microsoft Configuration Manager vs. Intune key comparisons

    This evaluation of Configuration Manager and Intune outlines the key features, pros and cons so admins know which tool — or a …


  • How to copy files from source to destination in PowerShell

    Take a closer look at these Copy-Item coding examples to build advanced PowerShell scripts that copy files with safety measures …

The running applications you see on your screen are a fraction of what is happening in Windows. From managing device drivers to ensuring security, a bunch of background processes maintain a functioning Windows PC.

For any system administrator overseeing multiple computers, it is important to be able to view the status of these critical services. The Task Manager approach is too slow for this, and you cannot automate it with a script.

The solution? Command-line tools. Using the Command Prompt or PowerShell, you can quickly get a read on the operational Microsoft services running on a system, helping you diagnose any issues swiftly. 

Listing Windows Services In the Command Prompt

While not as flexible or powerful as Windows PowerShell, the Command Prompt is still an excellent tool for system administrators. You can use the queryex command to get the status of both active and disabled services and then use the taskkill command to end pesky processes.

  1. To use the queryex command, run Command Prompt as an Administrator. You can find the app by searching cmd in the start menu.

  1. There are many ways of using the sc queryex command. Type and State are the two most commonly used parameters. For example, enter the following command to view all  Windows processes:

sc queryex type=service state=all

  1. The default view can be a bit overwhelming. You can display just the names of processes to make the list easier to parse:

sc queryex type=service state=all | find /i “SERVICE_NAME:”

  1. By default, the command lists all active processes. To look for inactive ones, modify the state parameter:

sc queryex type=service state=inactive

  1. You can also query the status of a specific process by its name. This is incredibly useful for system administrators, as they can set up batch files to check many processes at once. Here’s an example:

sc query DeviceInstall

Listing Windows Services in PowerShell

PowerShell is meant to be a dedicated command-line shell for modern Windows. As such, it provides access to pretty much every operating system component through commands, and Windows services are no exception.

PowerShell’s advantage is that you can automate it easily. All PowerShell commands can be compiled into complex scripts, allowing you to set up system administration tasks on multiple PCs without hassle.

  1. Start by opening PowerShell. You can search for it in the Start Menu; just make sure to run an elevated instance (i.e., as an Administrator).

  1. The simplest command for listing Windows services on PowerShell is Get-Service. It shows all services on your computer, along with their status and names. The only problem is that the list of services can be pretty long.

  1. When using Get-Service, it is a better idea to export the list to a text file. You can do this using pipes, like this:

Get-Service | Out-File “C:\logs\All_Services.txt”

  1. To look up the status of a specific service, follow the Get-Service command with the name of the service. You can request the status of multiple processes by separating their names with commas.

Get-Service CryptSvc, COMSysApp

  1. Pipes can also be used to combine the Get-Service cmdlet with the Where-Object function and filter the results by Status. The following command illustrates this by getting all Running services:

Get-Service | Where-Object {$_.Status -EQ “Running”}

Checking Service Dependencies

Any complex process is split into multiple interdependent services. This is why simply getting the status of a particular service is often not enough. You also need to check the status of the services that service is dependent on.

  1. To view the services required by a particular service, use the -RequiredServices flag with the Get-Service cmdlet. Here’s an example:

Get-Service -Name CryptSvc –RequiredServices

  1. Similarly, to get a list of services that depend on a specific service, take advantage of the -DependentServices flag.

Get-Service -Name CryptSvc -DependentServices

These two flags are crucial in writing scripts to automatically start or stop Windows services, as they give you a way to keep track of all the services connected with the affected service.

Listing Windows Services On Remote Computers

The PowerShell method is not limited to local computers. You can use the Get-Service cmdlet with the same syntax described above to query the processes of remote PCs as well. Just append the -ComputerName flag at the end to specify which remote computer to retrieve information from. 

Here’s an example:

get-service CryptSvc -ComputerName Workstation7

Managing Windows Services in PowerShell

Getting the status of services isn’t the only thing you can do in Windows PowerShell. As a full-fledged scripting environment, it provides script alternatives to all GUI options. 

Powershell cmdlets can stop, start, restart, or even modify services. Paired with automated Get-Service commands, PowerShell scripts can be written to fully automate everyday system management tasks.

  1. In addition to querying the status of services, you can also use PowerShell to manage them. Starting or stopping services can be done with a single command, requiring only the name of the service. For example, this is how you can stop a service:

Stop-Service -Name Spooler

  1. Starting a service goes similarly:

Start-Service -Name Spooler

  1. If a service isn’t working correctly, you can also choose to restart it:

Restart-Service -Name Spooler

  1. There is also the Set-Service cmdlet that can be used to change the properties of a service. Here we disable the automatic startup of the Print Spooler service:

Set-Service ‘Spooler’ -StartupType Disabled

What Is the Best Way to List Windows Services?

Whether you are running Windows 10 or a Windows Server, being able to view a list of all Windows services can be handy. You can diagnose issues with critical system functions or stop unnecessary Microsoft services to improve performance.

For this purpose, PowerShell is the best option. While you can obtain a service list in Command Prompt, the additional functionality provided by PowerShell is more useful.

You can use PowerShell cmdlets to get the service status of Windows processes, filtering them by their status or other parameters. It is also easy to determine dependent services and start or stop them as required.

Related Posts

  • How to Fix a “This file does not have an app associated with it” Error on Windows
  • How to Add OneDrive to Windows File Explorer
  • How to Fix an Update Error 0x800705b4 on Windows
  • How to Resolve “A JavaScript error occured in the main process” Error on Windows
  • How to Fix the Network Discovery Is Turned Off Error on Windows

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как посмотреть частоту оперативная память на компьютере windows 10
  • Возвращение компьютера в исходное состояние windows 10 что это
  • Не отключайте usb накопитель windows to go как отключить
  • Стилизация рабочего стола windows 10
  • Что нужно сделать чтобы активировать windows