Backing up the Event Log to a central location 
Author Message
 Backing up the Event Log to a central location

G'day all,

Can anyone explain why the following doesn't work? I'm pretty new to vbs and
trying to write a script to backup the event logs from a bunch of servers to
a central location.

set LogFileSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}//Server01").Ex
ecQuery("select * from Win32_NTEventLogFile where LogfileName='Security'")

For each Logfile in LogFileSet
 RetVal = LogFile.BackupEventlog("\\Central\share\appeventlog.evt")
 if RetVal <> 0 then WScript.Echo "Log Not Backed Up"
 if RetVal = 0 then WScript.Echo "Log Backed Up"
Next

Thank you kindly,
AC



Fri, 09 May 2003 03:00:00 GMT  
 Backing up the Event Log to a central location
Hi,

 in a similar question, I asked back:What is your error message??!!!

 I suspect, you have to use the "security" qualifier, if you'll backup the
security eventlog!!

--snip

GetObject("winmgmts:{impersonationLevel=impersonate,(Backup,Security)}//Serv
er01").Ex

--snip

May be, that helps!!

Best regards,
Manfred Braun

(Private)
Lange Roetterstrasse 7
D68167 Mannheim
Germany


(Remove the anti-spam-underscore to mail me!)



Quote:
> G'day all,

> Can anyone explain why the following doesn't work? I'm pretty new to vbs
and
> trying to write a script to backup the event logs from a bunch of servers
to
> a central location.

> set LogFileSet =

GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}//Server01").Ex
Quote:
> ecQuery("select * from Win32_NTEventLogFile where LogfileName='Security'")

> For each Logfile in LogFileSet
>  RetVal = LogFile.BackupEventlog("\\Central\share\appeventlog.evt")
>  if RetVal <> 0 then WScript.Echo "Log Not Backed Up"
>  if RetVal = 0 then WScript.Echo "Log Backed Up"
> Next

> Thank you kindly,
> AC



Fri, 09 May 2003 03:00:00 GMT  
 Backing up the Event Log to a central location
Hi, thanks for your response...
What happens is, if I make the explicit backup path as
"c:\temp\appeventlog.evt", the script works.
However, the path "c:\temp\appeventlog.evt" is not the local path of the
server that I ran the script from. It is the path on the server of which I'm
trying to save the log.

It seem like the UNC doesn't work....

This must have something to do with how WMI works...

TIA,
AC


Quote:
> Hi,

>  in a similar question, I asked back:What is your error message??!!!

>  I suspect, you have to use the "security" qualifier, if you'll backup the
> security eventlog!!

> --snip

GetObject("winmgmts:{impersonationLevel=impersonate,(Backup,Security)}//Serv
Quote:
> er01").Ex

> --snip

> May be, that helps!!

> Best regards,
> Manfred Braun

> (Private)
> Lange Roetterstrasse 7
> D68167 Mannheim
> Germany


> (Remove the anti-spam-underscore to mail me!)



> > G'day all,

> > Can anyone explain why the following doesn't work? I'm pretty new to vbs
> and
> > trying to write a script to backup the event logs from a bunch of
servers
> to
> > a central location.

> > set LogFileSet =

GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}//Server01").Ex
Quote:
> > ecQuery("select * from Win32_NTEventLogFile where

LogfileName='Security'")

- Show quoted text -

Quote:

> > For each Logfile in LogFileSet
> >  RetVal = LogFile.BackupEventlog("\\Central\share\appeventlog.evt")
> >  if RetVal <> 0 then WScript.Echo "Log Not Backed Up"
> >  if RetVal = 0 then WScript.Echo "Log Backed Up"
> > Next

> > Thank you kindly,
> > AC



Fri, 09 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Backing up Event Logs

2. Saving Eventlog using WMI to Central Location

3. Saving eventlog to a remote central location

4. Logging events to NT Event Log from VB5

5. Making an Event Log Message File in VB (NOT WRITING TO THE EVENT LOG)

6. Event Log: Writing to the NT Event Log

7. Making back ups

8. Running from Server or Central Location

9. Logging events using app.log

10. Help: Event Logging to System log

11. Logging to the Event Log

12. Logging to WINNT event log

 

 
Powered by phpBB® Forum Software