Solved

Clearing Event Logs with WBEM WMI object

Posted on 2004-04-29
1
839 Views
Last Modified: 2007-12-19
What permissions and user rights are required.  I'm getting SWbemObject: Access denied messages while running a script with an admin account. The line in question is

objWMIService.ClearEventLog()
0
Comment
Question by:ojfahoum
1 Comment
 
LVL 5

Accepted Solution

by:
Droby10 earned 250 total points
ID: 10956772
without more info to go on, my first thoughts are this:

for the security log you will need to impersonate the security role, in addition to any others you are using (ie. backup).  this isn't required for the application or system logs, but without it you will get access denied when attempting to clear the security event log.

ie.

' obtain all event logs
set alllogs=GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}").ExecQuery("select * from Win32_NTEventLogFile")
' will fail when attempting to clear secevent.

-vs-

' obtain all event logs
set alllogs=GetObject("winmgmts:{impersonationLevel=impersonate,(Security,Backup)}").ExecQuery("select * from Win32_NTEventLogFile")
' should not fail when attempting to clear secevent.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now