Loading...
X

How to manage services on Windows

What are services

Services are a kind of programs that run in the background and do not require user input.

Services can either be specific to the Windows operating system or be third-party applications. Examples of services that the user can install himself: web server, VNC remote desktop server, SSH server, MySQL server.

You can manage services:

  • in the graphical interface
  • in command line
  • in PowerShell

Configuring services in the GUI

To open the service manager, search for “Services” and press Enter:

Another way to open this window is to press Win+r and enter:

services.msc

Here, in the Name column, you will see a list of the services running on your system, along with their Description. You will also be able to see their Status – whether they are running or stopped, as well as Startup Type and Log On As.

Windows service startup types

Windows 10 offers the following startup types:

  • Automatic
  • Automatic (Delayed Start)
  • Manual
  • Manual (Trigger Start)
  • Disabled

Start, stop, disable Windows services

To start, stop, pause, resume, or restart any Windows service, select the service and right-click it. You will be presented with these options.

If you want to manage additional options, double-click the Service to open its properties window.

Here, in the Startup Type drop-down menu, you will be able to select the startup type for the Service.

In the Service Status section, you will see the Start, Stop, Pause, Resume buttons.

In the Properties window, you will also see other tabs, such as Log On, Recovery, and Dependencies, which offer additional options and information.

After making the changes, you will need to click “Apply” button.

Managing Services Using the Command Line

You can also use command prompt to start, stop, pause, resume service. To use the console, open a Command Prompt or PowerShell with administrator rights and run one of the following commands.

To start the service:

net start SERVICE

For example, to start the mysql service:

net start mysql

To stop the service:

net stop SERVICE

For example, to stop the mysql service:

net stop mysql

To pause a service (not all services can be paused!):

net pause SERVICE

To resume the service:

net continue SERVICE

To disable autostart of a service:

sc config "SERVICE_NAME" start=disabled

For example, to disable subsequent starts of the mysql service:

sc config "mysql" start=disabled

To enable autostart of the service:

sc config "SERVICE_NAME" start=auto

For example, to enable autostart of the mysql service:

sc config "mysql" start=auto

Enumerating the states of active services and drivers

sc query

Enumerating Win32 Services Only

sc query type=service

To view the status of a specific service:

sc query SERVICE_NAME

For example, to see the status of an Apache2.4 service:

sc query Apache2.4

Managing Windows Services with PowerShell

PowerShell is Microsoft's task automation and configuration management framework. In this section, we will walk you through how to manage Windows services through PowerShell, as it is much faster and more efficient than other methods.

As you probably know, one of the most important parts of every operating system is the service that runs through it, and in general, it can be said that every part of the operating system that starts has a specific service that can be controlled and monitored.

Here's a comprehensive guide to using PowerShell to manage Windows services.

Launch PowerShell Terminal as Administrator. To do this, press Win+x and select Windows PowerShell (Admin):

First, you should get a list of available services using the following command:

Get-Service

This is the sample output you will receive.

In the default output, you will see 3 main sections: Status, Name and DisplayName. Now, if you want to find and list a specific service, you can filter out any of the parameters.

Examples

Show all services with names starting with wi:

Get-Service -Name wi*

Show all services whose display names start with win:

Get-Service -DisplayName win*

Note: if you want to access another computer over the network, you can view the list of services for that system using this command:

Get-Service -ComputerName SERVER1

An important part of service management is the management of dependent services.

To access the list of DependentServices for a specific service, we can use the following command:

Get-Service -Name SERVICE_NAME -DependentServices

For example:

Get-Service -Name WSearch -DependentServices

You can also use the RequiredServices parameter to get a list of service prerequisites.

Get-Service -Name SERVICE_NAME -RequiredServices

For example:

Get-Service -Name WSearch -RequiredServices

So with the commands above, we can find the name of the service you want, see the status and associated services or their dependencies. Now let's look at the commands for managing services.

To stop the service using PowerShell, you can use the following command:

Stop-Service -Name SERVICE_NAME

For example:

Stop-Service -Name Apache2.4

The following examples will be shown on the Apache2.4 service. That is, in the following commands, replace “Apache2.4” with the name of the service you are interested in.

To start a service in PowerShell, you can use this command:

Start-Service -Name Apache2.4

One of the most commonly used commands for working with services is the restart service command. The structure of the service restart command is as follows:

Restart-Service -Name Apache2.4

Finally, the following command is used to temporarily suspend a service.

Suspend-Service -Name Apache2.4

To change the startup mode of the service, use a command of the form:

Set-Service -Name SERVICE_NAME -StartupType START_TYPE

The START_TYPE can be:

  • Automatic – the service will be started or was started by the operating system at system startup. If an auto-start service depends on a manually-started service, the manually-started service also starts automatically at system startup.
  • AutomaticDelayedStart – Runs shortly after the system boots.
  • Disabled – the service is disabled and cannot be started by the user or application.
  • InvalidValue – Has no effect. The cmdlet does not return an error, but the StartupType of the service is not changed.
  • Manual – the service is started only manually, by the user, using the service control manager or application.

These are the most commonly used commands for managing services in PowerShell. For more information on PowerShell commands and how they work, use the Get-Help command.

For example:

Get-Help *-Service
Get-Help New-Service

Leave Your Observation

Your email address will not be published. Required fields are marked *