?
Solved

Clearing Event Logs with WBEM WMI object

Posted on 2004-04-29
1
Medium Priority
?
844 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Droby10 earned 1000 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With the rising number of cyber attacks in recent years, keeping your personal data safe has become more important than ever. The tips outlined in this article will help you keep your identitfy safe.
The recent Petya-like ransomware attack served a big blow to hundreds of banks, corporations and government offices The Acronis blog takes a closer look at this damaging worm to see what’s behind it – and offers up tips on how you can safeguard your…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

764 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