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.
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.
156
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.
159
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
160
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
163
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services.
164

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 11 08/13/2026
11.0.0-preview.6.26359.118 25 07/15/2026
11.0.0-preview.5.26302.115 24 06/09/2026
11.0.0-preview.4.26230.115 31 05/13/2026
11.0.0-preview.3.26207.106 43 04/14/2026
11.0.0-preview.2.26159.112 39 03/12/2026
11.0.0-preview.1.26104.118 41 02/11/2026
10.0.11 11 08/13/2026
10.0.10 24 07/15/2026
10.0.9 23 06/09/2026
10.0.8 33 05/13/2026
10.0.7 36 04/21/2026
10.0.6 40 04/14/2026
10.0.5 46 03/13/2026
10.0.4 39 03/12/2026
10.0.3 46 02/11/2026
10.0.2 54 01/16/2026
10.0.1 77 12/10/2025
10.0.0 88 11/13/2025
10.0.0-rc.2.25502.107 81 10/15/2025
10.0.0-rc.1.25451.107 91 09/10/2025
10.0.0-preview.7.25380.108 83 08/13/2025
10.0.0-preview.6.25358.103 112 07/16/2025
10.0.0-preview.5.25277.114 110 06/07/2025
10.0.0-preview.4.25258.110 127 05/15/2025
10.0.0-preview.3.25171.5 129 04/11/2025
10.0.0-preview.2.25163.2 138 04/01/2025
10.0.0-preview.1.25080.5 120 04/01/2025
9.0.19 12 08/13/2026
9.0.18 20 07/15/2026
9.0.17 19 06/09/2026
9.0.16 22 05/13/2026
9.0.15 37 04/14/2026
9.0.14 39 03/12/2026
9.0.13 52 02/11/2026
9.0.12 47 01/14/2026
9.0.11 101 11/14/2025
9.0.10 78 10/15/2025
9.0.9 100 09/10/2025
9.0.8 94 08/05/2025
9.0.7 106 07/09/2025
9.0.6 112 06/12/2025
9.0.5 122 05/16/2025
9.0.4 122 04/10/2025
9.0.3 126 04/01/2025
9.0.2 121 04/01/2025
9.0.1 116 04/01/2025
9.0.0 117 11/14/2024
9.0.0-rc.2.24473.5 132 10/22/2024
9.0.0-rc.1.24431.7 148 10/23/2024
9.0.0-preview.7.24405.7 127 08/22/2024
9.0.0-preview.6.24327.7 162 07/22/2024
9.0.0-preview.5.24306.7 162 07/22/2024
9.0.0-preview.4.24266.19 162 07/22/2024
9.0.0-preview.3.24172.9 144 07/22/2024
9.0.0-preview.2.24128.5 139 07/22/2024
9.0.0-preview.1.24080.9 146 07/22/2024
8.0.1 129 10/21/2024
8.0.0 136 04/17/2024
8.0.0-rc.2.23479.6 134 07/22/2024
8.0.0-rc.1.23419.4 133 07/22/2024
8.0.0-preview.7.23375.6 156 07/22/2024
8.0.0-preview.6.23329.7 150 07/22/2024
8.0.0-preview.5.23280.8 139 07/22/2024
8.0.0-preview.4.23259.5 143 07/22/2024
8.0.0-preview.3.23174.8 143 07/22/2024
8.0.0-preview.2.23128.3 151 07/22/2024
8.0.0-preview.1.23110.8 138 07/22/2024
7.0.1 150 07/22/2024
7.0.0 138 07/22/2024
7.0.0-rc.2.22472.3 162 07/22/2024
7.0.0-rc.1.22426.10 151 07/22/2024
7.0.0-preview.7.22375.6 157 07/22/2024
7.0.0-preview.6.22324.4 146 07/22/2024
7.0.0-preview.5.22301.12 157 07/22/2024
7.0.0-preview.4.22229.4 140 07/22/2024
7.0.0-preview.3.22175.4 151 07/22/2024
7.0.0-preview.2.22152.2 153 07/22/2024
7.0.0-preview.1.22076.8 139 07/22/2024
6.0.2-mauipre.1.22102.15 121 01/01/2025
6.0.1 145 07/22/2024
6.0.0 145 07/22/2024
6.0.0-rc.2.21480.5 139 07/22/2024
6.0.0-rc.1.21451.13 139 07/22/2024
6.0.0-preview.7.21377.19 187 07/21/2024
6.0.0-preview.6.21352.12 163 07/22/2024
6.0.0-preview.5.21301.5 145 07/22/2024
6.0.0-preview.4.21253.7 136 07/22/2024
6.0.0-preview.3.21201.4 138 07/22/2024
6.0.0-preview.2.21154.6 134 07/22/2024
6.0.0-preview.1.21102.12 145 07/22/2024
5.0.0 155 07/22/2024
5.0.0-rc.2.20475.5 150 07/20/2024
5.0.0-rc.1.20451.14 157 07/22/2024
5.0.0-preview.8.20407.11 149 07/22/2024
5.0.0-preview.7.20364.11 160 07/22/2024
5.0.0-preview.6.20305.6 146 07/22/2024
5.0.0-preview.5.20278.1 129 07/22/2024
5.0.0-preview.4.20251.6 140 07/22/2024
5.0.0-preview.3.20214.6 145 07/22/2024
5.0.0-preview.2.20160.6 125 07/22/2024
5.0.0-preview.1.20120.5 135 07/22/2024
4.7.0 149 07/22/2024
4.7.0-preview3.19551.4 147 07/22/2024
4.7.0-preview2.19523.17 141 07/22/2024
4.7.0-preview1.19504.10 145 07/22/2024
4.6.0 137 07/22/2024
4.6.0-rc1.19456.4 152 07/22/2024
4.6.0-preview9.19421.4 154 07/22/2024
4.6.0-preview9.19416.11 140 07/22/2024
4.6.0-preview8.19405.3 159 07/22/2024
4.6.0-preview7.19362.9 138 07/22/2024
4.6.0-preview6.19303.8 149 07/22/2024
4.6.0-preview6.19264.9 140 07/22/2024
4.6.0-preview5.19224.8 146 07/22/2024
4.6.0-preview4.19212.13 153 07/22/2024
4.6.0-preview3.19128.7 143 07/22/2024
4.6.0-preview.19073.11 136 07/22/2024
4.6.0-preview.18571.3 136 07/22/2024
4.5.0 143 07/22/2024
4.5.0-rc1 141 07/22/2024
4.5.0-preview2-26406-04 149 07/22/2024
4.5.0-preview1-26216-02 143 07/22/2024
4.5.0-preview1-25914-04 148 07/22/2024
4.4.1 149 07/22/2024
4.4.0 155 07/22/2024
4.4.0-preview2-25405-01 144 07/22/2024
4.4.0-preview1-25305-02 144 07/22/2024
4.3.0 154 07/22/2024
4.3.0-preview1-24530-04 135 07/22/2024
4.1.0 160 07/22/2024
4.1.0-rc2-24027 148 07/22/2024
4.1.0-beta-23516 136 07/22/2024
4.1.0-beta-23409 164 07/22/2024
4.1.0-beta-23225 156 07/22/2024
4.0.0-beta-23123 137 07/22/2024
4.0.0-beta-23109 149 07/22/2024
4.0.0-beta-23019 166 07/22/2024
4.0.0-beta-22816 131 07/22/2024
4.0.0-beta-22605 144 07/22/2024
4.0.0-beta-22416 138 07/22/2024