listing existing windows services with python
db3l.net at gmail.com
Wed Feb 17 00:34:13 CET 2010
alex23 <wuwei23 at gmail.com> writes:
> News123 <news... at free.fr> wrote:
>> What is the best way with python to get a list of all windows services.
>> As a start I would be glad to receive only the service names.
>> However it would be nicer if I could get all the properties of a service
>> as well.
> I highly recommend Tim Golden's fantastic WMI module.
Another alternative is the win32service module from the pywin32
package (which IMO you'll almost certainly want available when doing
any significant Windows-specific operations) which wraps the native
win32 libraries for enumerating, querying and controlling services.
A simple loop could use EnumServicesStatus to iterate through the
services, OpenService with the SERVICE_QUERY_CONFIG flag to get a
handle to each service, and then QueryServiceConfig to retrieve
Since pywin32 is a relatively thin wrapper over the win32 libraries,
pure MSDN documentation can be used for help with the calls, augmented
by any Python-related information contained in the pywin32
More information about the Python-list