I am getting errors I can't pin down 
Author Message
 I am getting errors I can't pin down

    Any help would be greatly appreciated.  When I run the script I get an
error in 68, which is the priveledge portion relating to reading the logs (i
think).  I tried one of the MS scripts copied directly from, and it dosn't
work either.  I am running the script as a domain admin.  NT4 is the OS.
Any help would be greatly appreciated.

'******************************************************************
'     Program: ForEachUniqueEventLogs.vbs
'     Version: 0.01 Alpha
'     Changes:
'   Thanks To: Mark Hauschild
'            : Rick Henry
'            : msnews.microsoft.com



'  Programmer: Edwin Holley
'        Date: 11APR03
' Description: This program is designed to be run scheduled
' on a nightly basis.  It will then Archive event logs into folders
' based on type of event log.  The file will be name based on date,
' in military format.  I will then call a log parser and mail
' important logs to my email.
'******************************************************************

Option Explicit

dim dtmThisDay, dtmThisMonth, dtmThisYear, strComputer, strBasePath
dim ClearAuditLogs, LogFile, strBackupName, strFullPath, objWMIService
Dim colLogFiles, objLogfile, strBasicPath, objFSO

'Assign Stuff
'get day month year for navy standard date format (26MAR03)
dtmThisDay  = Day(Now)
dtmThisMonth = Left(Month(Now), 3)
dtmThisYear  = Right(Year(Now), 2)

'Set up File System object to allow file\folder manipulation and checking
Set objFSO = CreateObject("Scripting.FileSystemObject")

'set computer to be run on "." is current
strComputer = "."

'set the base path to save the logs to
strBasePath = "E:\AuditLogs"

'creat the array for the three different type of logs
Dim AuditLogs(2)
AuditLogs(0) = "System"
AuditLogs(1) = "Security"
AuditLogs(2) = "Application"

'Set some options
ClearAuditLogs = False  'Set as a safety during debug and testing must be
true or false

'This loop chew it up and spits it out.
For Each LogFile In AuditLogs
 'create string for file name
 strBackupName = "" & dtmThisDay & dtmThisMonth & dtmThisYear & "_" &
LogFile & ".evt"
 strBasicPath = "" & strBasePath & "\" & LogFile & " logs"
 strFullPath = "" & strBasePath & "\" & LogFile & " logs\" & strBackupName

 'Check existance of Folder
 If objFSO.FolderExists(strBasicPath) Then

  'Check the existance of file
  If objFSO.FileExists(strFullPath) Then
   'Inform user that file already exists, but same problem as with
directory,
   'I need to incriment name, and restart from the file check 8-(
   Wscript.Echo "File {" & strFullPath & "} already exist."
  Else

   'Set up for pull from Audit Logs, based on log is being pulled
   Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,(Backup)}!\\" & _
    strComputer & "\root\cimv2")
   Set colLogFiles = objWMIService.ExecQuery _
    ("Select * from Win32_NTEventLogFile where LogFileName=" & LogFile & "")

  'Process the audit log
  For Each objLogfile in colLogFiles
   objLogFile.BackupEventLog(strFullPath)
  Next

  'Clear Audit Log if ClearAuditLogs is true
  If ClearAuditLogs Then
   objLogFile.ClearEventLog()
  End If
 End If
 Else
  'Let user know that the folders don't exists
  Wscript.Echo "Folder {" & strBasicPath & "} does Not exist."

  'This should create the path, but I need to re-run the check folder?
  'This wont't work 8-(
'  ParentFolder = strBasePath
'  Set objShell = CreateObject("Shell.Application")
'  set objFolder = objShell.NameSpace(ParentFolder)
'  objFolder.NewFolder strBasicPath
 End If
Next



Tue, 27 Sep 2005 19:02:05 GMT  
 I am getting errors I can't pin down

Quote:

>     Any help would be greatly appreciated.  When I run the script I get an
> error in 68, which is the priveledge portion relating to reading the logs (i
> think).  I tried one of the MS scripts copied directly from, and it dosn't
> work either.  I am running the script as a domain admin.  NT4 is the OS.

Hi

If line 68 is this one,

   Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,(Backup)}!\\" & _
    strComputer & "\root\cimv2")

I would guess that you don't have installed the WMI Core on your NT4 computer:

WMI CORE 1.5 for Windows NT 4.0
http://www.microsoft.com/downloads/release.asp?ReleaseID=18491

Also, you need to take the Security privilege to access the the security event
log, so instead of (Backup) in the 'Set objWMIService' line, you should use
(Backup, Security)

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Thu, 29 Sep 2005 02:37:05 GMT  
 I am getting errors I can't pin down
Cool that solved the error.  But the script does nothing, unless the
directory does not exist, then you get the messages.  I can't even see
wscript pop up in process list.  Thanks for your help.



Quote:

> >     Any help would be greatly appreciated.  When I run the script I get
an
> > error in 68, which is the priveledge portion relating to reading the
logs (i
> > think).  I tried one of the MS scripts copied directly from, and it
dosn't
> > work either.  I am running the script as a domain admin.  NT4 is the OS.

> Hi

> If line 68 is this one,

>    Set objWMIService = GetObject("winmgmts:" _
>     & "{impersonationLevel=impersonate,(Backup)}!\\" & _
>     strComputer & "\root\cimv2")

> I would guess that you don't have installed the WMI Core on your NT4
computer:

> WMI CORE 1.5 for Windows NT 4.0
> http://www.microsoft.com/downloads/release.asp?ReleaseID=18491

> Also, you need to take the Security privilege to access the the security
event
> log, so instead of (Backup) in the 'Set objWMIService' line, you should
use
> (Backup, Security)

> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Sat, 01 Oct 2005 21:28:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Please Help: Why am I now getting this error

2. Why am I getting this error ?

3. 'Canned' data in VB program

4. Help, I'm getting Path/File Error

5. I am getting an error I don't understand.

6. HELP!!! Cmd.CreateParameter I am getting crazy

7. No one has gotten back to me on this yet so I am reposting

8. why am I getting this error??

9. Null Values - WHY am I getting this error?

10. VB4 16-bits: I am getting an error message when compiling

11. Serial Pins and Com pins

12. i am getting error sending stdPic to out-of-Process Component

 

 
Powered by phpBB® Forum Software