softworkz has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks!
can someone point me in the right direction as to where to get the same results that ps gave on *nix machines? I've looked at some modules

use Win32::PerfLib;
use Win32::Process::Info;

but I don't see where they would give the same results that ps does.
I.E USER PID %CPU %MEM etc....

I wish I had ps on windows :(

Replies are listed 'Best First'.
Re: process status on windows
by fglock (Vicar) on Sep 30, 2002 at 19:45 UTC

    You get  ps.exe when you install cygwin.

    Cygwin is a UNIX environment, developed by Red Hat, for Windows. It consists of two parts:
    A DLL (cygwin1.dll) which acts as a UNIX emulation layer providing substantial UNIX API functionality. A collection of tools, ported from UNIX, which provide UNIX/Linux look and feel.

Re: process status on windows
by Aristotle (Chancellor) on Sep 30, 2002 at 19:53 UTC

    Maybe you want to try Cygwin then? :-)

    Update: Doh, beaten to the punch.

    Makeshifts last the longest.

Re: process status on windows
by AcidHawk (Vicar) on Oct 01, 2002 at 11:30 UTC

    A Bit off the perl topic but you get pulist.exe and pstat.exe from the WinNT and 2000 Resource kit.

    Or you can try this (Although it wont give you the Mem utilisation but it might be a start)... ALL CREDIT must go to Dave Roth whose site and books have become sacred to me..

    # ProcList.pl # ----------- # This script will display the list of current processes along with # the process's PID and binary path. # Syntax: # perl ProcList.pl [Machine Name] # # Examples: # perl ProcTree # perl ProcTree.pl \\server # # 2002.01.20 rothd@roth.net # # Permission is granted to redistribute and modify this code as long + as # the below copyright is included. # # Copyright © 2002 by Dave Roth # Courtesty of Roth Consulting # http://www.roth.net/ use Win32::OLE qw( in ); use Win32::OLE::Variant; $Machine = "\\\\."; $Machine = shift @ARGV if( $ARGV[0] =~ /^\\\\/ ); # WMI Win32_Process class $CLASS = "winmgmts:{impersonationLevel=impersonate}$Machine\\Root\\cim +v2"; $WMI = Win32::OLE->GetObject( $CLASS ) || die; foreach my $Proc ( sort {lc $a->{Name} cmp lc $b->{Name}} in( $WMI->In +stancesOf( "Win32_Process" ) ) ) { printf( "% 5d) %s ", $Proc->{ProcessID}, "\u$Proc->{Name}" ); print "( $Proc->{ExecutablePath} )" if( "" ne $Proc->{ExecutablePath +} ); print "\n"; }

    There are a ton of REALLY helpful admin scripts for the Win32 platform on his site

    -----
    Of all the things I've lost in my life, its my mind I miss the most.