Hi,
Is it possible to access the services in windows using the .net framework?
Yes. Try the following code:
Code:
ServiceController[] controllers = ServiceController.GetServices();
foreach( ServiceController controller in controllers ){
// Check the status of this service to see if
// it can be stopped
bool bCanStop = controller.CanStop;
// Check if the service recieves notification when
// system shuts down.
bool bCanShutDown = controller.CanShutdown;
// Check if the service can be paused and continued.
bool bPauseNContinue = controller.CanPauseAndContinue;
}
Remember to reference System.ServiceP rocess assembly and put using statement up front.
Comment