Hi,
You can use an OLE connection to WMI (if the WMI service is active, wich is
most of the time true on a server...), otherwise see "Win32::Perflib" wich
obtain the same info from the registry.
regards,
BT
=================================================
Sample WMI script to obtain process ID, Working Set size and Name
You need : to be Administrator + WMI service active on the server
One parameter is \\netbiosname
=================================================
#!/usr/bin/perl -w
#
use strict;
use Win32::OLE qw( in );
our $exit = "0";
my $Class = "Win32_Process";
(my $Machine = shift @ARGV || "." ) =~ s/^[\\\/]+//;
if( my $WMIServices = Win32::OLE->GetObject(
"winmgmts:{impersonationLevel=impersonate,(security)}//$Machine" ) ) {
foreach my $Processes ( in( $WMIServices->InstancesOf( $Class )) )
{
printf "%5d %7d Kb %s \n", $Processes->{ProcessId},
$Processes->{WorkingSetSize}/1024, $Processes->{Name};
}
$exit = 0;
}
else
{
print("\nsorry error\n");
$exit = 1;
}
exit( $exit )
========================================================
On Fri, 3 Aug 2007 15:48:45 +0530, "Ankit Mehrotra"
<[EMAIL PROTECTED]> said:
>Hi,
>
> I am trying to build a script for finding the state of the processes
> that are running in the windows environment. Basically , an attempt to
>make some thing synonymous to "ps" command of the *nix for finding the
>state of processes.
>
>Does any body has any clue about a package which is available for getting
>this information using Perl ?
>
>Thanks
>Ankit
_________________________________________________________________
À faire rêver : des endroits célèbres à voir
http://search.live.com/images/results.aspx?q=Endroits+c%C3%A9l%C3%A8bres++&mkt=fr-ca&FORM=SERNEP
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs