Search code examples
securityvb6active-directoryadsi

Querying Service Status with ADSI - what rights are needed?


I'm using VB6 and using ADSI to query for the status (running or not) of a Windows Service. See this MS article: http://msdn.microsoft.com/en-us/library/aa746322(v=vs.85).aspx.

With a user who is a member of the USERS group, I'm receiving a thrown exception. I believe it's on the GetObject method:

Set comp = GetObject("WinNT://.,Computer")

The exception is: 80070005 "General access denied error"

Running the same code as a member of POWER USERS, however, works just fine.

Elevating all users to Power users isn't an option. What exact rights do I need to have granted in order for this function to run successfully?

I've tried running procmon.exe, and wasn't able to determine from the output as to what or where a denial is occurring.

Thanks!

Edit: This is running on XP sp2.


Solution

  • Sounds like you're running into a UAC barrier. I'm not familiar with IADsService, but it is hardly necessary in determining if a Windows service is running. Have you considered using API functions to query your service? Try QueryServiceStatus on a service opened with SERVICE_QUERY_STATUS.