Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Windows 2000 / Security / August 2005

Tip: Looking for answers? Try searching our database.

Programmatically determine the account under which a service is ru

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 04 Aug 2005 17:31 GMT
Hello,

I'm looking for a C++ code snippet that would help determine the 'log on as'
account for a Windows service, MSSQLSERVER, for example.

Any help appreciated!

Signature

Chris

Joe Richards [MVP] - 05 Aug 2005 00:09 GMT
Check out QueryServiceConfig.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/qu
eryserviceconfig.asp?frame=true


You could also probably use WMI but WMI is such a pain that it generally isn't
worth it, especially in C++.

--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net

> Hello,
>
> I'm looking for a C++ code snippet that would help determine the 'log on as'
> account for a Windows service, MSSQLSERVER, for example.
>
> Any help appreciated!
Chris - 05 Aug 2005 00:42 GMT
Thank you!  That was very quick!!

I hate to be a doof - but, which is the 'log on as' parameter?

// Print the configuration information.

   printf("\nSample_Srv configuration: \n");
   printf(" Type: 0x%x\n", lpqscBuf->dwServiceType);
   printf(" Start Type: 0x%x\n", lpqscBuf->dwStartType);
   printf(" Error Control: 0x%x\n", lpqscBuf->dwErrorControl);
   printf(" Binary path: %s\n", lpqscBuf->lpBinaryPathName);

   if (lpqscBuf->lpLoadOrderGroup != NULL)
       printf(" Load order group: %s\n", lpqscBuf->lpLoadOrderGroup);
   if (lpqscBuf->dwTagId != 0)
       printf(" Tag ID: %d\n", lpqscBuf->dwTagId);
   if (lpqscBuf->lpDependencies != NULL)
       printf(" Dependencies: %s\n", lpqscBuf->lpDependencies);
   if (lpqscBuf->lpServiceStartName != NULL)
       printf(" Start Name: %s\n", lpqscBuf->lpServiceStartName);
   if (lpqscBuf2->lpDescription != NULL)
       printf(" Description: %s\n", lpqscBuf2->lpDescription);

Signature

Chris

> Check out QueryServiceConfig.
>
[quoted text clipped - 13 lines]
> >
> > Any help appreciated!
Roger Abell - 05 Aug 2005 06:36 GMT
> Thank you!  That was very quick!!
>
> I hate to be a doof - but, which is the 'log on as' parameter?

StartName

> // Print the configuration information.
>
[quoted text clipped - 16 lines]
>
> > Check out QueryServiceConfig.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/qu
eryserviceconfig.asp?frame=true


> > You could also probably use WMI but WMI is such a pain that it generally isn't
> > worth it, especially in C++.
[quoted text clipped - 9 lines]
> > >
> > > Any help appreciated!
Roger Abell - 05 Aug 2005 06:38 GMT
> Check out QueryServiceConfig.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/qu
eryserviceconfig.asp?frame=true


> You could also probably use WMI but WMI is such a pain that it generally isn't
> worth it, especially in C++.

I would bet that is more a C++ thing than a WMI thing.
IMO win32_Service object in WMI is extremely simple and handy
and I find its use remoted in a domain context quite acceptibly fast.
Signature

ra

> > Hello,
> >
> > I'm looking for a C++ code snippet that would help determine the 'log on as'
> > account for a Windows service, MSSQLSERVER, for example.
> >
> > Any help appreciated!
Joe Richards [MVP] - 06 Aug 2005 02:26 GMT
WMI seems to be ok for one off stuff. The times I have tried to use it in
monitoring or other things it tends to start to get screwy. OVO/W uses it and I
know the OVO/W SPI developers are moving to get away from it due to all of the
support issues they have encountered with it.

--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net

>>Check out QueryServiceConfig.
>
[quoted text clipped - 9 lines]
> IMO win32_Service object in WMI is extremely simple and handy
> and I find its use remoted in a domain context quite acceptibly fast.
Roger Abell - 08 Aug 2005 00:03 GMT
When a remote "gets toasted" relative to its WMI support then
yes, it can be trying to diag and get that machine's WMI support
whole again.

Signature

Roger Abell
Microsoft MVP (Windows  Security)

> WMI seems to be ok for one off stuff. The times I have tried to use it in
> monitoring or other things it tends to start to get screwy. OVO/W uses it and I
[quoted text clipped - 6 lines]
>
> >>Check out QueryServiceConfig.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/qu
eryserviceconfig.asp?frame=true


> >>You could also probably use WMI but WMI is such a pain that it generally
> >
[quoted text clipped - 5 lines]
> > IMO win32_Service object in WMI is extremely simple and handy
> > and I find its use remoted in a domain context quite acceptibly fast.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.