#!/usr/bin/perl use Win32::EventLog; use MIME::Lite::TT::HTML; use strict; my $Tabelle = ""; #---------------------------------------------------------------------------# sub GetEvents { my ($recs, $base, $off, $hashRef, $Event, $Status); my $handle=Win32::EventLog->new("Application", $ENV{ComputerName}); $handle->GetNumber($recs); $handle->GetOldest($base); $off = $recs - 1; while ($off >= 0) { $handle->Read(EVENTLOG_BACKWARDS_READ | EVENTLOG_SEEK_READ, $base + $off, $hashRef); if ($hashRef->{Source} eq "p2fService") { Win32::EventLog::GetMessageText($hashRef); my $Msg = $hashRef->{Message}; my $Event = $hashRef->{EventID} & 1073741823; if ($Event == 1018) { my @lines = split /\n/, $Msg; open (MAIL, ">Mail.txt"); foreach my $line (@lines) { if ($line =~ /^[A-Z]{3}/) { $Status = ""; if ($line =~ /ERR (.*)./) { $Status = 'Fehler'; } elsif ($line =~ /LIC (.*)./) { $Status = 'Lizenzfehler'; } elsif ($line =~ /PRT (.*)./) { $Status = 'Druckerfehler'; } elsif ($line =~ /SPC (.*)./) { $Status = 'Debug'; } elsif ($line =~ /INT (.*)./) { $Status = 'Eingriff erforderlich'; } elsif ($line =~ /JAM (.*)./) { $Status = 'Papierstau'; } elsif ($line =~ /PAP (.*)./) { $Status = 'Kein Papier'; } elsif ($line =~ /TON (.*)./) { $Status = 'Tonerstand niedrig'; } elsif ($line =~ /OFL (.*)./) { $Status = 'Nicht betriebsbereit'; } elsif ($line =~ /COV (.*)./) { $Status = 'Abdeckung offen'; } elsif ($line =~ /NET (.*)./) { $Status = 'Netzwerkfehler'; } elsif ($line =~ /FUL (.*)./) { $Status = 'Ausgabefach voll'; } if ($Status ne "") { $Tabelle .= '