开发者

Permission settings for discovery of windows services

I'm setting up a windows service that monitors other services and will restart them if they get disconnected. For security reasons I've decided to run this service on a special "service" account and for each service it's supposed to have access to it granted to the service account by an administrator.

In order to do this I'm using the "ServiceController" class. I've been able to get it to work with local computer services but when I attempt to connect to a another network on the computer I get an invalidoperationexception. Is there a "browse" or "discover" permission that I can give to the service account?

'First line throw ex开发者_开发百科ception even though the service account has permission set for that 'particular service and that particular machine. Again works fine if the service is 'located on same machine

services = ServiceController.GetServices(serviceComputer).ToList()
Dim serviceOfInterest As ServiceController = (From service In _
                                                 services.DefaultIfEmpty(Nothing) _
                                                 Where service.ServiceName = "SomeServiceName" _
                                                 Select service).SingleOrDefault()
serviceOfInterest.Start();


The permissions you need are described here: http://msdn.microsoft.com/en-us/library/ms685981(VS.85).aspx.

Specifically, to obtain list of services you need SC_MANAGER_ENUMERATE_SERVICE. According to the table in the link above this permission is granted to:

  • Local authenticated users
  • LOCAL SYSTEM
  • BUILTIN\ADMINISTRATORS

apparently when connecting remotely the first two options are out, you only have one option left -- being part of the local administrators group.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜