KnightOfNi
KnightOfNi

Reputation: 850

How to view all windows services (including those disabled or not running) in python

I am working on a security project (for educational purposes) for which I have compiled a list of services which SHOULD be on a computer. It then subdivides them into which ones should be disabled, manual, or automatic. Obviously, it's quite tedious to run services.msc and peruse the list manually, so I'd like to give it a shot in python. Unfortunately, I can't find a way to list all of the services on a computer using Python. Can anyone help me out?

Upvotes: 0

Views: 1149

Answers (1)

Gerrat
Gerrat

Reputation: 29680

You could use Tim Golden's WMI module. Something like:

import wmi
c = wmi.WMI()
for service in c.Win32_Service():
    print(service.DisplayName)

Upvotes: 1

Related Questions