System.ServiceProcess.ServiceController 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.
Showing the top 20 packages that depend on System.ServiceProcess.ServiceController.
Packages | Downloads |
---|---|
TopShelf.ServiceInstaller
Topshelf is an open source project for hosting services without friction. By referencing Topshelf, your console application *becomes* a service installer with a comprehensive set of command-line options for installing, configuring, and running your application as a service.
|
33 |
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.
|
25 |
TopShelf.ServiceInstaller
Topshelf is an open source project for hosting services without friction. By referencing Topshelf, your console application *becomes* a service installer with a comprehensive set of command-line options for installing, configuring, and running your application as a service.
|
23 |
TopShelf.ServiceInstaller
Topshelf is an open source project for hosting services without friction. By referencing Topshelf, your console application *becomes* a service installer with a comprehensive set of command-line options for installing, configuring, and running your application as a service.
|
22 |
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 Core as well as .NET Standard.
|
21 |
Microsoft.Web.Administration
This package contains the .NET Core version of the Microsoft Web Administration assembly.
|
19 |
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 Core as well as .NET Standard.
6c6b536dffb4da0c45ff14921bfee10265265050
When using NuGet 3.x this package requires at least version 3.4.
|
19 |
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 Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
18 |
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 Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
16 |
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 Core as well as .NET Standard.
9b5053f09fac4a2d615619197924072b9571da78
When using NuGet 3.x this package requires at least version 3.4.
|
15 |
TopShelf.ServiceInstaller
Topshelf is an open source project for hosting services without friction. By referencing Topshelf, your console application *becomes* a service installer with a comprehensive set of command-line options for installing, configuring, and running your application as a service.
|
14 |
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.
|
14 |
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 Core as well as .NET Standard.
|
14 |
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.
|
13 |
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 Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
13 |
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.
|
12 |
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.
|
11 |
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 Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
11 |
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- System.Diagnostics.EventLog (>= 9.0.0)
.NET 8.0
- System.Diagnostics.EventLog (>= 9.0.0)
.NET 9.0
- System.Diagnostics.EventLog (>= 9.0.0)
.NET Standard 2.0
- System.Diagnostics.EventLog (>= 9.0.0)