This script shows all running processes with their process IDs. It uses the wmi-class from Tim Golden. Please put it into the directory where you run this script from.
import wmi c = wmi.WMI () for process in c.Win32_Process (): print process.ProcessId, process.Name