How to programmatically retrieving the "Startup Type" for Windows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know that I can use the ServiceController.GetServices(MachineName) to
retrieve the list of services for the specified machine, and then I can
retrieve the various properties for each service.

What I cannot figure out is how to retrieve the "Startup Type" (Automatic,
Manual, or Disabled) for the specified service.

Can anyone point me in the right direction?

Thanks,

Eric
 
This appears to me to be the Installation and events of a service, not an
external app that retrieves the "Startup Type" of an existing service.

If I am incorrect, then please let me know.

Thanks,

Eric
 
Eric:

One way to do this to use the registry; read the
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName\Start"
value (REG_DWORD) to get the startup type: 2 (Automatic), 3 (Manual), or 4
(Disabled).

Hope this helps!

Shariq Khan
(e-mail address removed)
 
Thanks. I'll take a look at this... only problem I can forsee is accessing
remote registries, but then again, I think .NET can do that pretty easily.

Thanks again,

Eric
 
Back
Top