> -----Original Message-----
> From: Chas Owens [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 01, 2006 1:56 PM
> To: Ryan Frantz
> Cc: beginners@perl.org
> Subject: Re: Win32::Process::Info - Get Owner Information
> 
> Are you sure you permission to talk to the other servers?

Yes.  I am a domain admin and have full access to everything.  This only
fails if I try to loop through a list of hosts.

> 
> You might also want to check to see if there is any way to get
> extended error messages from Win32::Process::Info.

I agree.  I've been looking over the available documentation for the
module to find a way to get more info.  Is there anything available in
Perl itself that may help provide additional diags?

> 
> On 2/1/06, Ryan Frantz <[EMAIL PROTECTED]> wrote:
> > All,
> >
> >
> >
> > I've been working on a script to grab the owner of processes on my
> > systems and it works great if I limit it to one machine at a time.
If
> > try to pass it multiple hostnames in a loop, it bombs out after the
> > first host is completed.  I've Googled, checked the docs for the
module,
> > and checked ActiveState's lists but can't seem to find a way around
> > this.  See code below...
> >
> >
> >
> > --begin code--
> >
> >
> >
> > use warnings;
> >
> > use strict;
> >
> >
> >
> > use Win32::Process::Info;
> >
> >
> >
> > my @servers = (
> >
> >   'this',
> >
> >   'that',
> >
> >   'theother',
> >
> > );
> >
> >
> >
> > @servers = sort @servers;
> >
> >
> >
> > #my $server = 'this';
> >
> >
> >
> > sub getProcInfo {
> >
> >             my ( $server ) = @_;
> >
> >             print "\n-- $server --\n";
> >
> >             my $processObj = Win32::Process::Info->new( $server,
'WMI'
> > );
> >
> >             my @procInfo = $processObj->GetProcInfo();
> >
> >
> >
> >             # this should give us a list of anonymous hashes...
> >
> >             foreach my $info ( @procInfo ) {
> >
> >                         if ( ref $info ) {
> >
> >                                     my $procName;
> >
> >                                     my $procOwner;
> >
> >                                     foreach my $key ( keys %{ $info
} )
> > {
> >
> >                                                 # grab the keys
first...
> >
> >                                                 #print "$key\n";
> >
> >                                                 #print $key . " = "
. ${
> > $info }{ $key } . "\n" if ( $key eq 'Name' );
> >
> >                                                 #print $key . " = "
. ${
> > $info }{ $key } . "\n" if ( $key eq 'Owner' );
> >
> >                                                 $procName = ${ $info
}{
> > $key } if ( $key eq 'Name' );
> >
> >                                                 $procOwner = ${
$info }{
> > $key }   if ( $key eq 'Owner' );
> >
> >                                     }
> >
> >
> >
> >                                     if ( $procName and $procOwner )
{
> >
> >                                                             #print
"\n";
> >
> >                                                             print
> > $procName . ": " . $procOwner . "\n";
> >
> >                                     }
> >
> >
> >
> >                         } else {
> >
> >                                     print "Info: $info\n";
> >
> >                         }
> >
> >             }
> >
> > }
> >
> >
> >
> > foreach my $server ( @servers ) {
> >
> >             getProcInfo( $server );
> >
> > }
> >
> >
> >
> > --end code-
> >
> >
> >
> > Any help is appreciated.
> >
> >
> >
> > ry
> >
> >
> >

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to