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

Discussion in 'Python' started by Giampaolo Rodola', Jun 12, 2009.

  1. On 12 Giu, 00:18, "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?
    >
    > 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
     
    Giampaolo Rodola', Jun 12, 2009
    #1
    1. Advertising

  2. Giampaolo Rodola'

    Tim Golden Guest

    Giampaolo Rodola' wrote:
    > On 12 Giu, 00:18, "Harry" <> 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
     
    Tim Golden, Jun 12, 2009
    #2
    1. Advertising

  3. On 12 Giu, 13:02, Tim Golden <> wrote:
    > Giampaolo Rodola' wrote:
    > > On 12 Giu, 00:18, "Harry" <> 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
     
    Giampaolo Rodola', Jun 12, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert W. Eckert
    Replies:
    4
    Views:
    797
    =?Utf-8?B?Um9iIEVja2VydA==?=
    Oct 5, 2004
  2. Ricky Koh
    Replies:
    4
    Views:
    409
    Scott Condit
    Aug 27, 2003
  3. Replies:
    5
    Views:
    319
  4. franckspike
    Replies:
    1
    Views:
    338
    Boris
    Jul 3, 2008
  5. Sol Linderstein
    Replies:
    3
    Views:
    215
    Matt Garrish
    Jun 18, 2004
Loading...

Share This Page