command line of a process.exe on another host

Tim Golden mail at timgolden.me.uk
Fri Jun 12 03:24:26 EDT 2009


Harry wrote:
> HI ,
> I have number of process run on different windows servers which run's 
> with different command line parameters. for example "process.exe 
> -input<ddd> statusurl: http://sss.com "., These parameters can vary from 
> host to host. using Psexec I know the PID and process name which are 
> running on these machines, but how I can read the command line 
> parameters of these process. Is there a way to read these command line 
> of the proess via python pls?

WMI can get this for you. This example uses my WMI module
from here:

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

but it's not hard to do it with "raw" Python / Windows.

<code>
import wmi

c = wmi.WMI ("other_machine")
for p in c.Win32_Process (name="process.exe"):
  print p.CommandLine

</code>

TJG



More information about the Python-list mailing list