List running processes on 64-bit Windows

Posted on

Question :

List running processes on 64-bit Windows

I amm writing a little python script that will grab information from VMs of Windows that I am running.

At the moment I can list the processes on a 32bit XP machine with the following method:

Is it possible to somehow detect the version of windows running and excute a different method for getting the processes on a 64bit machine, I am trying to get the processes from a 64Bit Vista and 64bit Windows 7.

Any ideas?

Asked By: RailsSon


Answer #1:

There is another recipe on activestate that does a similar thing, but uses the Performance Data Helper library (PDH) instead.

I have tested this on my Windows 7 64bit machine and it works there – so presumably the same function will work on both 32bit and 64 bit windows.

You can find the recipe here:

Another method is using WMI, there is an example here in Python using the wmi module:

import wmi
c = wmi.WMI ()

for process in c.Win32_Process ():
  print process.ProcessId, process.Name
Answered By: Andre Miller

Answer #2:

If you don’t want to rely on any extra installed modules then you can parse the output of wmic, e.g.:

c:> wmic process get description,executablepath    
explorer.exe               C:Windowsexplorer.exe
cmd.exe                    C:WindowsSysWOW64cmd.exe
conhost.exe                C:Windowssystem32conhost.exe


Answered By: orip

Answer #3:

For similar purposes I have used psutil library. Some hints:

  • list processes with psutil.pids() (reference)
  • inspect process information with process = psutil.Process(pid) (reference)
  • do process.kill or process.terminate()

Installation on windows – pip will do installation from the source (which means compiling), so you probably want to download binary installation from

Answered By: Robert Lujo

Answer #4:

The cleanest way I found to solve this was to use the psutil library as recommended by Robert Lujo:


Note that it returns a generator object, issuing a process object at a time. For example if you need the list of process names, you can do something like:

[ for p in psutil.process_iter()]
Answered By: jonathanrocher

Answer #5:

You should be able to do this by exposing Windows Management Instrumentation within each VM. This tool gives you access to a bunch of system data, including processes, see

You should be able to popen one of the commands in the preceding link to get the info you’re looking for.

Answered By: Dana the Sane

Leave a Reply

Your email address will not be published.