#!/usr/bin/perl -w use strict; use Win32::EventLog; my @nodes = qw(NODE1 NODE2 NODE3); foreach my $node(@nodes) { &GetEvents($node); } sub GetEvents { my($myServer) = @_; my($date)=join("-", ((split(/\s+/, scalar(localtime)))[0,1,2,4])); my($dest); my @logs =qw(Security System Application); foreach my $eventLog (@logs) { my $handle=Win32::EventLog->new($eventLog, $myServer) || die "Can't open Application EventLog on $myServer $!"; $dest="C:\\Perl\\scripts\\$eventLog\\$date.evt"; $handle->Backup($dest) || die "Could not backup and clear the $eventLog EventLog on $myServer ($^E)\n"; $handle->Close; } }