Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.57/5 (5 votes)
See more:
i am trying to find running services in my network systems. i am able to get some but for some systems i am getting error


"Cannot open Service Control Manager on computer machine name. This operation might require other privileges"

ServiceController sc = new ServiceController("OPCGlobasysService",servername);
                ServiceControllerStatus st = sc.Status;                
                if (st.ToString().ToLower() == "stopped")
                {
                    labelControl4.Text = "Installed but stopped";
                }

                if (st.ToString().ToLower() == "running")
                {
                    labelControl4.Text = "Installed and started";
                }


Thanks in advance
Posted
Updated 29-Mar-17 3:24am

1 solution

Well, what does the error say ? Your code obviously works, but on some machines, the user does not have the right privileges. Like the message says.
 
Share this answer
 
Comments
vrushali katkade 5-Jul-11 2:59am    
can you tell me how to assign privileges to the window service
Pete O'Hanlon 5-Jul-11 3:49am    
You don't assign privileges to the service. You set it up running under an account that has the relevant privileges.
Sergey Alexandrovich Kryukov 5-Jul-11 3:59am    
Correct. There are predefined accounts like "local service", "network service", etc. Their privileges can be adjusted in system settings; and also there can be account-based service. You can create a special privileged account and run the service with it.
--SA
vrushali katkade 5-Jul-11 5:41am    
how to create the special privileged account in service

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900