----- Original Message -----
From: "Paul Weintraub" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 09, 2001 11:28 AM
Subject: Win32::EventLog::GetMessageText problems
> Good day -
> I am having issues with the GetMessageText command. I
> am running a script that goes through a list of
> servers and goes to each of their eventlogs and prints
> out the errors that occur. I have set it up to print
> out the Event ID and the description. However, it
> seems that the description only appears part of the
> time. The line that I used to get the Message was
> straight out of the ActiveState documentation:
>
> Win32::EventLog::GetMessageText($hashRef);
>
> print "Entry $x: $hashRef->{Message}\n";
>
> It just seems intermittant - if I only run it for one
> server - local or remote - it seems to work pretty
> well, but when it references a list of servers it only
> returns a blank value. Here is the script:
>
> use Win32::EventLog;
>
> open(TXTFILE,
> "\\\\ebenezer\\d\$\\perlscr\\servers.txt");
> while (<TXTFILE>){
> $homesrv=$_; #opens file of
> chomp($homesrv); #servers to search through
>
> my $hashref;
>
> my %handle=(
> 'Length',NULL,
> 'RecordNumber',NULL,
> 'TimeGenerated',NULL,
> 'TimeWritten',NULL,
> 'EventID',NULL,
> 'EventType',NULL,
> 'Category',NULL,
> 'ClosingRecordNumber',NULL,
> 'Source',NULL,
> 'Computer',NULL,
> 'Strings',NULL,
> 'Data',NULL,
> );
>
> $handle=Win32::EventLog->new("System", "$homesrv")
>
> or die "Can't open Application EventLog\n";
>
> $handle->GetNumber($recs)
>
> or die "Can't get number of EventLog
> records\n";
>
> $handle->GetOldest($base)
>
> or die "Can't get number of oldest EventLog
> record\n";
>
> while ($base <= $recs) {
>
>
> $handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
>
> $base,
>
> $hashRef)
>
> or die "Can't read EventLog entry
> #$base\n";
>
> if ($hashRef->{EventType} == 1) {
>
>
> Win32::EventLog::GetMessageText($hashRef);
> print "\n$homesrv:\n";
> print "Entry $base:$hashRef->{Message}\n";
>
> }
>
> $base++;
>
> }
> }
>
Try the Win32::Lanman functions for eventlog queries. Specifically the
Win32::Lanman::GetEventDescription function.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin