title: How to clear Windows event logs without showing any error messages?
body: <p>I'm creating a Windows event log-clearing software.</p>
  
  <p>Whenever you clear logs from the command-line, there are always a few logs that can't be cleared, because either newer versions of Windows don't use the services those logs were meant for anymore, or they are important system logs that are almost always being written to.</p>
  
  <p>However, when the Windows event utility tool finds out it can't clear those logs, it relays an error message to the user. And because I'm trying to make this Batch file into an actual software, I would rather not have a bunch of messy error messages on the screen, for the sake of the user experience.</p>
  
  <p>The obvious answer to this problem would be to have the batch file start a separate background batch script to clear the logs, where the user wouldn't see any error messages, but modern-day anti-virus really don't like batch scripts, and flag them almost every time, so I can't do that.</p>
  
  <p>I tried to instead create a powershell script (Much more trusted by anti-virus.) to clear the logs. But because of the nature of powershell, even if it runs completely in the background, without a console, it still relays error messages in the form of VBS XMessages. </p>
  
  <p>If it's any useful, here's the two lines of code in the powershell script:</p>
  
  <pre><code>wevtutil el | Foreach-Object {wevtutil cl "$_"}
  exit
  </code></pre>
  
  <p>And for those who are wondering, yes, I am clearing logs with administrative privileges.</p>
  
  <p>I need one of the following:</p>
  
  <ul>
  <li><p>Another way to clear Windows event logs, that doesn't show error messages, that I can integrate into the software I'm creating.</p></li>
  <li><p>A way to forcefully clear those Windows event logs that normally can't be cleared.</p></li>
  <li><p>A way to have a batch script run without anti-virus having a stroke.</p></li>
  <li><p>A way to make the powershell script run completely in the background, without event displaying error messages.</p></li>
  </ul>