Re: command line of a process.exe on another host

2009-06-12 Thread Tim Golden

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 
-inputddd 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
--
http://mail.python.org/mailman/listinfo/python-list


Re: command line of a process.exe on another host

2009-06-12 Thread Giampaolo Rodola'
On 12 Giu, 00:18, Harry h...@pillai.co.uk wrote:
 HI ,
 I have number of process run on different windows servers which run's with
 different command line parameters. for example process.exe -inputddd
 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?

 any feedback appreciated..

 thanks
 Hari

You can easily do this with psutil [1]:


 import psutil, os
 p = psutil.Process(os.getpid())
 p.cmdline
['/usr/bin/python2.4']



Since psutil uses the native Windows calls to retrieve such kind of
info it's a lot faster than using any WMI-based solution.


[1] http://code.google.com/p/psutil/



--- Giampaolo
http://code.google.com/p/pyftpdlib
http://code.google.com/p/psutil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: command line of a process.exe on another host

2009-06-12 Thread Tim Golden

Giampaolo Rodola' wrote:

On 12 Giu, 00:18, Harry h...@pillai.co.uk wrote:

HI ,
I have number of process run on different windows servers which run's with
different command line parameters. 




You can easily do this with psutil [1]:



Since psutil uses the native Windows calls to retrieve such kind of
info it's a lot faster than using any WMI-based solution.



Looks great (and it's certainly fast). Can you pick up processes
on a different server? The docs don't seem to say so. Did I miss
something? (It's not clear that the OP actually wants that altho'
I read it that way).

TJG
--
http://mail.python.org/mailman/listinfo/python-list


Re: command line of a process.exe on another host

2009-06-12 Thread Giampaolo Rodola'
On 12 Giu, 13:02, Tim Golden m...@timgolden.me.uk wrote:
 Giampaolo Rodola' wrote:
  On 12 Giu, 00:18, Harry h...@pillai.co.uk wrote:
  HI ,
  I have number of process run on different windows servers which run's with
  different command line parameters.
  You can easily do this with psutil [1]:
  Since psutil uses the native Windows calls to retrieve such kind of
  info it's a lot faster than using any WMI-based solution.

 Looks great (and it's certainly fast). Can you pick up processes
 on a different server? The docs don't seem to say so. Did I miss
 something? (It's not clear that the OP actually wants that altho'
 I read it that way).

 TJG


Sorry, I didn't notice the OP meant to retrieve information from a
remote machine.
And no, psutil can't do anything like that.


--- Giampaolo
http://code.google.com/p/pyftpdlib
http://code.google.com/p/psutil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: command line of a process.exe on another host

2009-06-12 Thread Tim Wintle
On Thu, 2009-06-11 at 23:18 +0100, 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 -inputddd 
 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?

I'm not sure how well this will work, but it might be worth looking at
fabric - which lets you run through ssh onto lots of different machines
(so I assume you'll need openssh on those machines)

http://docs.fabfile.org/

Haven't used it myself, but I keep meaning to.


 
 any feedback appreciated..
 
 thanks
 Hari
 

-- 
http://mail.python.org/mailman/listinfo/python-list


command line of a process.exe on another host

2009-06-11 Thread Harry

HI ,
I have number of process run on different windows servers which run's with 
different command line parameters. for example process.exe -inputddd 
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?


any feedback appreciated..

thanks
Hari

--
http://mail.python.org/mailman/listinfo/python-list