System.ServiceProcess.ServiceController 11.0.0-preview.7.26381.103

About

Provides the System.ServiceProcess.ServiceController API, which allows to connect to a Windows service, manipulate it, or get information about it. Not supported on other platforms.

Key Features

  • Retrieve information from Windows services
  • Connect to and manipulate Windows services (start, pause, stop or other operations)

How to Use

Retrieve Windows service information

using System.ServiceProcess;

// Loop through all installed Windows services and print the name, status and display name.
foreach (ServiceController serviceController in ServiceController.GetServices())
{
    Console.WriteLine("Name: " + serviceController.ServiceName);
    Console.WriteLine("Status: " + serviceController.Status.ToString());
    Console.WriteLine("Display name: " + serviceController.DisplayName);
}

// Loop through all installed device driver services
foreach (ServiceController serviceController in ServiceController.GetDevices())
{
    Console.WriteLine("Name: " + serviceController.ServiceName);
    Console.WriteLine("Status: " + serviceController.Status.ToString());
    Console.WriteLine("Display name: " + serviceController.DisplayName);
}

Manipulate a Windows service

using System.ServiceProcess;

ServiceController service = new("TestServiceName");
if (service.CanStop && service.Status != ServiceControllerStatus.Stopped && service.Status != ServiceControllerStatus.StopPending)
{
    service.Stop();
}

Main Types

The main types provided by this library are:

  • System.ServiceProcess.ServiceController
  • System.ServiceProcess.ServiceControllerStatus
  • System.ServiceProcess.ServiceType

Additional Documentation

Feedback & Contributing

System.ServiceProcess.ServiceController is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on System.ServiceProcess.ServiceController.

Packages Downloads
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
148
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
149
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
150
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
151
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
152
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
153
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
154
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
155
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
157
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
158
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
162

https://go.microsoft.com/fwlink/?LinkID=799421

.NET 10.0

.NET 11.0

.NET Framework 4.6.2

.NET Standard 2.0

Version Downloads Last updated
11.0.0-preview.7.26381.103 4 08/13/2026
11.0.0-preview.6.26359.118 23 07/15/2026
11.0.0-preview.5.26302.115 22 06/09/2026
11.0.0-preview.4.26230.115 30 05/13/2026
11.0.0-preview.3.26207.106 37 04/14/2026
11.0.0-preview.2.26159.112 36 03/12/2026
11.0.0-preview.1.26104.118 37 02/11/2026
10.0.11 5 08/13/2026
10.0.10 20 07/15/2026
10.0.9 22 06/09/2026
10.0.8 30 05/13/2026
10.0.7 34 04/21/2026
10.0.6 38 04/14/2026
10.0.5 40 03/13/2026
10.0.4 36 03/12/2026
10.0.3 43 02/11/2026
10.0.2 52 01/16/2026
10.0.1 75 12/10/2025
10.0.0 84 11/13/2025
10.0.0-rc.2.25502.107 80 10/15/2025
10.0.0-rc.1.25451.107 86 09/10/2025
10.0.0-preview.7.25380.108 82 08/13/2025
10.0.0-preview.6.25358.103 111 07/16/2025
10.0.0-preview.5.25277.114 108 06/07/2025
10.0.0-preview.4.25258.110 123 05/15/2025
10.0.0-preview.3.25171.5 126 04/11/2025
10.0.0-preview.2.25163.2 135 04/01/2025
10.0.0-preview.1.25080.5 119 04/01/2025
9.0.19 4 08/13/2026
9.0.18 17 07/15/2026
9.0.17 18 06/09/2026
9.0.16 20 05/13/2026
9.0.15 34 04/14/2026
9.0.14 38 03/12/2026
9.0.13 49 02/11/2026
9.0.12 45 01/14/2026
9.0.11 97 11/14/2025
9.0.10 76 10/15/2025
9.0.9 97 09/10/2025
9.0.8 91 08/05/2025
9.0.7 100 07/09/2025
9.0.6 109 06/12/2025
9.0.5 119 05/16/2025
9.0.4 118 04/10/2025
9.0.3 124 04/01/2025
9.0.2 119 04/01/2025
9.0.1 115 04/01/2025
9.0.0 113 11/14/2024
9.0.0-rc.2.24473.5 129 10/22/2024
9.0.0-rc.1.24431.7 147 10/23/2024
9.0.0-preview.7.24405.7 122 08/22/2024
9.0.0-preview.6.24327.7 159 07/22/2024
9.0.0-preview.5.24306.7 160 07/22/2024
9.0.0-preview.4.24266.19 159 07/22/2024
9.0.0-preview.3.24172.9 142 07/22/2024
9.0.0-preview.2.24128.5 137 07/22/2024
9.0.0-preview.1.24080.9 143 07/22/2024
8.0.1 126 10/21/2024
8.0.0 134 04/17/2024
8.0.0-rc.2.23479.6 132 07/22/2024
8.0.0-rc.1.23419.4 132 07/22/2024
8.0.0-preview.7.23375.6 152 07/22/2024
8.0.0-preview.6.23329.7 149 07/22/2024
8.0.0-preview.5.23280.8 131 07/22/2024
8.0.0-preview.4.23259.5 141 07/22/2024
8.0.0-preview.3.23174.8 141 07/22/2024
8.0.0-preview.2.23128.3 149 07/22/2024
8.0.0-preview.1.23110.8 136 07/22/2024
7.0.1 147 07/22/2024
7.0.0 135 07/22/2024
7.0.0-rc.2.22472.3 158 07/22/2024
7.0.0-rc.1.22426.10 150 07/22/2024
7.0.0-preview.7.22375.6 153 07/22/2024
7.0.0-preview.6.22324.4 143 07/22/2024
7.0.0-preview.5.22301.12 155 07/22/2024
7.0.0-preview.4.22229.4 137 07/22/2024
7.0.0-preview.3.22175.4 150 07/22/2024
7.0.0-preview.2.22152.2 151 07/22/2024
7.0.0-preview.1.22076.8 137 07/22/2024
6.0.2-mauipre.1.22102.15 118 01/01/2025
6.0.1 143 07/22/2024
6.0.0 144 07/22/2024
6.0.0-rc.2.21480.5 137 07/22/2024
6.0.0-rc.1.21451.13 138 07/22/2024
6.0.0-preview.7.21377.19 184 07/21/2024
6.0.0-preview.6.21352.12 161 07/22/2024
6.0.0-preview.5.21301.5 142 07/22/2024
6.0.0-preview.4.21253.7 134 07/22/2024
6.0.0-preview.3.21201.4 135 07/22/2024
6.0.0-preview.2.21154.6 132 07/22/2024
6.0.0-preview.1.21102.12 144 07/22/2024
5.0.0 153 07/22/2024
5.0.0-rc.2.20475.5 147 07/20/2024
5.0.0-rc.1.20451.14 154 07/22/2024
5.0.0-preview.8.20407.11 147 07/22/2024
5.0.0-preview.7.20364.11 158 07/22/2024
5.0.0-preview.6.20305.6 145 07/22/2024
5.0.0-preview.5.20278.1 126 07/22/2024
5.0.0-preview.4.20251.6 136 07/22/2024
5.0.0-preview.3.20214.6 143 07/22/2024
5.0.0-preview.2.20160.6 123 07/22/2024
5.0.0-preview.1.20120.5 133 07/22/2024
4.7.0 147 07/22/2024
4.7.0-preview3.19551.4 145 07/22/2024
4.7.0-preview2.19523.17 140 07/22/2024
4.7.0-preview1.19504.10 143 07/22/2024
4.6.0 136 07/22/2024
4.6.0-rc1.19456.4 151 07/22/2024
4.6.0-preview9.19421.4 151 07/22/2024
4.6.0-preview9.19416.11 138 07/22/2024
4.6.0-preview8.19405.3 156 07/22/2024
4.6.0-preview7.19362.9 135 07/22/2024
4.6.0-preview6.19303.8 146 07/22/2024
4.6.0-preview6.19264.9 138 07/22/2024
4.6.0-preview5.19224.8 145 07/22/2024
4.6.0-preview4.19212.13 150 07/22/2024
4.6.0-preview3.19128.7 142 07/22/2024
4.6.0-preview.19073.11 135 07/22/2024
4.6.0-preview.18571.3 134 07/22/2024
4.5.0 141 07/22/2024
4.5.0-rc1 140 07/22/2024
4.5.0-preview2-26406-04 147 07/22/2024
4.5.0-preview1-26216-02 142 07/22/2024
4.5.0-preview1-25914-04 146 07/22/2024
4.4.1 147 07/22/2024
4.4.0 153 07/22/2024
4.4.0-preview2-25405-01 141 07/22/2024
4.4.0-preview1-25305-02 143 07/22/2024
4.3.0 151 07/22/2024
4.3.0-preview1-24530-04 134 07/22/2024
4.1.0 157 07/22/2024
4.1.0-rc2-24027 146 07/22/2024
4.1.0-beta-23516 135 07/22/2024
4.1.0-beta-23409 162 07/22/2024
4.1.0-beta-23225 153 07/22/2024
4.0.0-beta-23123 136 07/22/2024
4.0.0-beta-23109 146 07/22/2024
4.0.0-beta-23019 163 07/22/2024
4.0.0-beta-22816 130 07/22/2024
4.0.0-beta-22605 142 07/22/2024
4.0.0-beta-22416 135 07/22/2024