PC Review


Reply
Thread Tools Rate Thread

Backing Up and Clearing Event Logs If the Log Meets Specific Conditions

 
 
james
Guest
Posts: n/a
 
      10th Jul 2003
I am new to scripting using WScript/Cscript. When I run
the script to Backing Up and Clearing Event Logs If the
Log Meets Specific Conditions i get the following error:
->terminated entity reference - matching ';' not found

I have successfully loaded Windows Script V5.6 on a
Windows NT 4.0 Build 1381. I need this script to run
successfully on Windows 2000.

Script below:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate, (Backup,
Security)}!\\" _
& strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("SELECT * FROM Win32_NTEventLogFile")
For Each objLogfile in colLogFiles
If objLogFile.FileSize > 20000000 Then
strBackupLog = objLogFile.BackupEventLog _
("c:\scripts\" & objLogFile.LogFileName
& ".evt")
objLogFile.ClearEventLog()
End If
Next
-------

James

 
Reply With Quote
 
 
 
 
Carrie Garth \(MVP\)
Guest
Posts: n/a
 
      12th Jul 2003
Hi James,

You may want to try posting in a scripting newsgroup such as *.scripting.wsh

For access to the newsgroup via the Microsoft Communities Web Interface, try this URL
http://communities.microsoft.com/New....scripting.wsh

For those who read newsgroups using a NNTP newsreader, such as Outlook Express, and
use the msnews.microsoft.com news server, here is a link:
news://msnews.microsoft.com/microsof....scripting.wsh

Also, for a way to... . . .

- More easily find, read, post, and reply to, messages
- Organize and manage messages using folders, views, rules, etc.
- Easily find newsgroups of interest by entering text to search through the Microsoft
Public News Server's list of thousands of newsgroups dedicated to Microsoft
products

.. . . .... instead of accessing the Microsoft Public Newsgroups using the Web
Interface, consider using a newsreader such as Microsoft Outlook Express. For a Web
Page that includes instructions for setting up an account in Microsoft Outlook
Express that connects directly to the free Microsoft Public News Server, see the
following Web Page:

Internet Explorer Newsgroup Setup Instructions
http://www.microsoft.com/windows/ie/...oups/howto.asp

--
Carrie Garth, Microsoft MVP for Windows 2000
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- c x g

"james" <james AT icondesigns DOT com DOT ph>
: Wrote in message news:0ba101c3471b$e4f7ccc0$(E-Mail Removed)
: Sent: Thursday, July 10, 2003 02:46 PM
: I am new to scripting using WScript/Cscript. When I run
: the script to Backing Up and Clearing Event Logs If the
: Log Meets Specific Conditions i get the following error:
: ->terminated entity reference - matching ';' not found
:
: I have successfully loaded Windows Script V5.6 on a
: Windows NT 4.0 Build 1381. I need this script to run
: successfully on Windows 2000.
:
: Script below:
:
: strComputer = "."
: Set objWMIService = GetObject("winmgmts:" _
: & "{impersonationLevel=impersonate, (Backup,
: Security)}!\\" _
: & strComputer & "\root\cimv2")
: Set colLogFiles = objWMIService.ExecQuery _
: ("SELECT * FROM Win32_NTEventLogFile")
: For Each objLogfile in colLogFiles
: If objLogFile.FileSize > 20000000 Then
: strBackupLog = objLogFile.BackupEventLog _
: ("c:\scripts\" & objLogFile.LogFileName
: & ".evt")
: objLogFile.ClearEventLog()
: End If
: Next
: -------
:
: James
:

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PivotTable that meets conditions. lukus2005@gmail.com Microsoft Excel Discussion 3 27th Nov 2008 08:55 PM
How to create a formula that meets 2 different conditions... =?Utf-8?B?SmVubmlmZXI=?= Microsoft Excel Misc 2 25th Apr 2007 11:54 PM
sum column when it meets certain conditions =?Utf-8?B?amltc3dpbmRlcg==?= Microsoft Excel Worksheet Functions 4 21st Jul 2006 06:37 PM
Referencing cells text output if it meets specific conditions =?Utf-8?B?Q2hlcnNpZQ==?= Microsoft Excel Worksheet Functions 3 18th Apr 2005 04:34 PM
Clearing Event Logs =?Utf-8?B?SmFjb2Jzb24gVVNBRg==?= Microsoft Windows 2000 1 13th Oct 2004 08:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:01 AM.