Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event Viewer question

Status
Not open for further replies.
Sep 7, 2009
29
US
Hello, I was wondering if it is possible to change this code so that it checks Overwrite events as needed instead of Overwrite events older than 14 days?

Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate,(Security)}!\\" & _ 
   strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery("Select * from Win32_NTEventLogFile")

For each objLogfile in colLogFiles
   strLogFileName = objLogfile.Name
   Set wmiSWbemObject = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2:" _
      & "Win32_NTEventlogFile.Name='" & strLogFileName & "'")
   wmiSWbemObject.MaxFileSize = 2500000000
   wmiSWbemObject.OverwriteOutdated = 14
   wmiSWbemObject.Put_

Next
 
You must have used better search terms than me. I been researching on Google for about two weeks. Thanks.
 
No problem. I just used OverwriteOutdated as the search term. Pretty nice page, rare to see a page that actually shows screenshots of what the corresponding code affects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top