in reply to clearing 2k eventlog

If it's not dying the only thing that comes to mind is that you forgot to close the eventlog, ie: $Event->Close();. Whether or not that happens automatically when $Event goes out of scope, I don't know, but you should call Close either way (being explicit is goood). If that doesn't work, meaning the changes don't get recorded, I sugguest you try upgrading Wil32::EventLog (which version do you have). Also, you might wanna try "Backup" to see if that works.

update: D'oh! I didn't even notice that error message you gave, "no such file or directory", that was your answer right there ;)

 
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void

perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Replies are listed 'Best First'.
Re: (crazyinsomniac) Re: clearing 2k eventlog
by RayRay459 (Pilgrim) on Dec 28, 2001 at 00:33 UTC
    I had the path wrong for $directory. here's my working script:
    # Ray Espinoza # eventclear.pl # This will clear the local eventlog to be used in the update.cmd scri +pt for new builds. ###################################################################### +################## #!/usr/bin/perl use Win32::EventLog; use strict; my ($Event, $filename, $directory); $directory = 'c:/temp/'; for ('System', 'Security', 'Application') { $Event = new Win32::EventLog ("$_", "") || die "can't create o +bject\n"; $filename = $directory . $_ . '.evt'; print " $filename exists\n" if (-e "$filename"); $Event->Clear($filename)or warn " $!"; $Event->Close(); }