System.ServiceProcess.ServiceController
9.0.0
Prefix Reserved
dotnet add package System.ServiceProcess.ServiceController --version 9.0.0
NuGet\Install-Package System.ServiceProcess.ServiceController -Version 9.0.0
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.0" />
paket add System.ServiceProcess.ServiceController --version 9.0.0
#r "nuget: System.ServiceProcess.ServiceController, 9.0.0"
// Install System.ServiceProcess.ServiceController as a Cake Addin #addin nuget:?package=System.ServiceProcess.ServiceController&version=9.0.0 // Install System.ServiceProcess.ServiceController as a Cake Tool #tool nuget:?package=System.ServiceProcess.ServiceController&version=9.0.0
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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- System.Diagnostics.EventLog (>= 9.0.0)
-
.NETStandard 2.0
- System.Diagnostics.EventLog (>= 9.0.0)
-
net8.0
- System.Diagnostics.EventLog (>= 9.0.0)
-
net9.0
- System.Diagnostics.EventLog (>= 9.0.0)
NuGet packages (184)
Showing the top 5 NuGet packages that depend on System.ServiceProcess.ServiceController:
Package | Downloads |
---|---|
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard. |
|
Microsoft.Extensions.Hosting.WindowsServices
.NET hosting infrastructure for Windows Services. |
|
Microsoft.Web.Administration
This package contains the .NET Core version of the Microsoft Web Administration assembly. |
|
Microsoft.AspNetCore.Hosting.WindowsServices
ASP.NET Core hosting infrastructure and startup logic for web applications running within a Windows service. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/af22effae4069a5dfb9b0735859de48820104f5b |
|
AspNetCore.HealthChecks.System
HealthChecks.System is the system health check package. |
GitHub repositories (78)
Showing the top 5 popular GitHub repositories that depend on System.ServiceProcess.ServiceController:
Repository | Stars |
---|---|
microsoft/PowerToys
Windows system utilities to maximize productivity
|
|
PowerShell/PowerShell
PowerShell for every system!
|
|
netchx/netch
A simple proxy client
|
|
Jackett/Jackett
API Support for your favorite torrent trackers
|
|
Klocman/Bulk-Crap-Uninstaller
Remove large amounts of unwanted applications quickly.
|