List of running processes in 64-bit Windows

I am writing a small python script that will capture information from the Windows virtual machines that I run.

Currently, I can list the processes on a 32-bit XP machine in the following way:

http://code.activestate.com/recipes/305279/

Is it possible to somehow determine the version of Windows and release another method to get processes on a 64-bit machine, I'm trying to get processes with 64-bit Vista and 64-bit Windows 7.

Any ideas?

+5
source share
5 answers

, , (PDH).

64- Windows 7, - 32-, 64- .

: http://code.activestate.com/recipes/303339/

- WMI, Python wmi:

http://timgolden.me.uk/python/wmi/cookbook.html

import wmi
c = wmi.WMI ()

for process in c.Win32_Process ():
  print process.ProcessId, process.Name
+15

- , wmic, :

c:\> wmic process get description,executablepath    
...
explorer.exe               C:\Windows\explorer.exe
cmd.exe                    C:\Windows\SysWOW64\cmd.exe
conhost.exe                C:\Windows\system32\conhost.exe
...

: http://geekpedia.wordpress.com/2008/08/18/use-command-line-to-track-windows-processes/

+19

psutil . :

  • psutil.pids() ()
  • process = psutil.Process(pid) ()
  • do process.kill process.terminate()

windows - pip ( ), , , https://pypi.python.org/pypi/psutil/#downloads.

+6

, , , psutil, :

psutil.process_iter()

, -, . , , - :

[p.name() for p in psutil.process_iter()]
+1

You must do this by exposing the "Windows Management Tool" in each virtual machine. This tool gives you access to a collection of system data, including processes, see http://technet.microsoft.com/en-us/library/cc757287%28WS.10%29.aspx

You must be able popento execute one of the commands in the previous link to get the information you are looking for.

0
source

All Articles