Sreenath G

Sreenath G

  • NA
  • 233
  • 311.8k

How to get Windows service Domain\Username it is logged in with

Jun 29 2011 8:34 AM
 

Hi,

I am using below code to get all the windows services in a server. I want to know the details of Domain\User, windows service is logged in with. How can achive this.

 

ServiceController[] lFnGetAllServicesInServer(string aStrServer)

        {

 

            ServiceController[] lArrObjServiceController = null;

 

            try

            {

               

                lArrObjServiceController = ServiceController.GetServices(aStrServer.Trim());

 

                return lArrObjServiceController;

 

            }

            catch (Exception ex)

            {

                return lArrObjServiceController;

            }

            finally

            {

 

            }

 

        }

 

Please help out


Answers (3)