Windows 10: Cannot clear Event Viewer logs with .ps1 script

Discus and support Cannot clear Event Viewer logs with .ps1 script in Windows 10 Performance & Maintenance to solve the problem; I created a PowerShell script saved as a .ps1 file, which is stated below. Whenever I run it, it says "Access is denied" and does not clean Event... Discussion in 'Windows 10 Performance & Maintenance' started by S Malik, Apr 19, 2019.

  1. S Malik Win User

    Cannot clear Event Viewer logs with .ps1 script


    I created a PowerShell script saved as a .ps1 file, which is stated below. Whenever I run it, it says "Access is denied" and does not clean Event Viewer logs. Please take a look at the attached screenshots and let me know what I am doing wrong. By the way, whenever I run the script below in PowerShell with administrative privileges, it does clear all Event Viewer logs.

    wevtutil el | Foreach-Object {wevtutil cl "$_"}


    Cannot clear Event Viewer logs with .ps1 script [​IMG]

    Cannot clear Event Viewer logs with .ps1 script [​IMG]

    Cannot clear Event Viewer logs with .ps1 script [​IMG]


    :)
     
    S Malik, Apr 19, 2019
    #1
  2. JohnBurns Win User

    Clear All Event Logs in Event Viewer in Windows  


    FWIW CCleaner will clear the Event Viewer Logs - just check the box under Windows>Advanced>Windows Events Logs. run CCleaner and it's that simple. Much faster than most ,bat files I've tried. Just a suggestion.
     
    JohnBurns, Apr 19, 2019
    #2
  3. Clearing Administrative Events Log in Windows10

    How To Clear Administrative Events Log

    The Administrative Events log (listed under Custom Views) in the Event Viewer is a Filter that contains all of the event from the System, Security and Application event logs.

    You can either clear these individual logs, or use the instructions below to clear all the event logs.

    To Clear All Event Logs in Event Viewer in Windows

    cmd shell solution:

    PowerShell solution:

    Source How to Clear All Event Logs in Event Viewer in Windows

    To Clear Individual Event Viewer Logs in Event Viewer

    Source How to Clear All Event Logs in Event Viewer in Windows
     
    DavidPostill, Apr 19, 2019
    #3
  4. Cliff S Win User

    Cannot clear Event Viewer logs with .ps1 script

    Clear All Event Logs in Event Viewer in Windows


    For Windows logs and Application and Services logs, there is also the manual way to clear specific logs(only these 2 sections, custom views can be Deleted and lost, but not Cleared for example:

    Cannot clear Event Viewer logs with .ps1 script [​IMG]


    Cannot clear Event Viewer logs with .ps1 script [​IMG]
     
    Cliff S, Apr 19, 2019
    #4
Thema:

Cannot clear Event Viewer logs with .ps1 script

Loading...
  1. Cannot clear Event Viewer logs with .ps1 script - Similar Threads - Cannot clear Event

  2. Cannot clear Event Viewer logs with .ps1 script

    in Windows 10 Support
    Cannot clear Event Viewer logs with .ps1 script: I created a PowerShell script saved as a .ps1 file, which is stated below. Whenever I run it, it says "Access is denied" and does not clean Event Viewer logs. Please take a look at the attached screenshots and let me know what I am doing wrong. By the way, whenever I run the...
  3. Bug in Event Viewer - Filter Current Log by Event Source

    in Windows 10 Support
    Bug in Event Viewer - Filter Current Log by Event Source: I found a bug trying to view the Event Log on both my v 1803 PCs for the Option Filter Current Log by Event Source. Nothing appears in the drop down list unless the screen scaling is set to 100%. This strange behaviour is supported by many users based on a Google search. It...
  4. No log file locations in Event Viewer

    in Windows 10 Customization
    No log file locations in Event Viewer: I opened Win 10's Event Viewer (first as myself, second as Administrator) and tried to create a Custom View. I chose reporting By Log, but when I clicked on the drop-down menu for log locations, none were listed. What gives?...
  5. How to clear the Event Log in Windows 10

    in Windows 10 News
    How to clear the Event Log in Windows 10: [ATTACH] Windows 10 is known for acting up now and again with several types of errors. Now, you may want to get a deeper understanding of the errors, and that’s where the Event Log comes into play. Event Log files basically [...] This post How to clear the Event Log in...
  6. Event Viewer Logs

    in Windows 10 Support
    Event Viewer Logs: I’m currently on Win10 Pro x64, version 1709, Build 16299.371. Searching in my Event Viewer, I noticed some logs under the “Applications and Services Logs” folder, which I don’t recall having previously (pointed with red arrow, in the image) and are all inactive! Can...
  7. Clear Event Viewer Scheduler?

    in Windows 10 Support
    Clear Event Viewer Scheduler?: Could someone make the "Clear All Event Viewer Logs using a BAT file" self starting such as making it run automatically on a daily basis or show me what code I would need to add to it to do that for me. I would just love to clear out the 10016s and 7031s codes daily. Thanks...
  8. Failed to clear event logs

    in Windows 10 Performance & Maintenance
    Failed to clear event logs: Hi @Brink, hope you are around for this! LOL This has not occurred between October 16, 2016, when I purchased this it, and today. So, if it is a minor issue, I am OK with ignoring these results. Failed to clear event logs Failed to clear event logs using...
  9. Clear All Event Logs in Event Viewer in Windows

    in Windows 10 Tutorials
    Clear All Event Logs in Event Viewer in Windows: Thank you very much, Brink, for this new tutorial! *Smile I will present the results after applying the commands on my system. First of all, it has indeed cleared my Event Viewer logs: [img] I used the command in CMD, which by the way I have been always using (I...
  10. Clearing event viewer entries

    in Windows 10 Support
    Clearing event viewer entries: How can I construct a .bat file to clear entries in the event viewer. Thanks 12367