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

Discus and support Cannot clear Event Viewer logs with .ps1 script in Windows 10 Support 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 Support' 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. Event viewer clear logs without administrator privileges

    in Windows 10 Gaming
    Event viewer clear logs without administrator privileges: Dear Microsoft Team,I have a windows 11 laptop. When I am logged with a non-admin user, I cannot clear logs. Is there a possibility to permit this non-admin user to clear logs in Event Viewer?Regards....
  3. Event viewer clear logs without administrator privileges

    in Windows 10 Software and Apps
    Event viewer clear logs without administrator privileges: Dear Microsoft Team,I have a windows 11 laptop. When I am logged with a non-admin user, I cannot clear logs. Is there a possibility to permit this non-admin user to clear logs in Event Viewer?Regards....
  4. Event Viewer Log.

    in Windows 10 Ask Insider
    Event Viewer Log.: Need to create an event viewer log that tracks USB connects and disconnects. I have all my USB devices disconnecting and reconnecting. I need to identify if it's possibly my UPS (usb connected to PC), because it showed I had a battery discharge when i first installed my...
  5. Is there a batch file to clear Event Viewer?

    in Windows 10 Support
    Is there a batch file to clear Event Viewer?: I have one for Windows 7 and I was wondering if there was one out to clear the Event Viewer in Win 10 Home x64? OS Version10.0.18363.836 (Win10 19H2 [1909] November 2019 Update) I've just gotten Win 10 to behave as I like, but all the tweaking and restoring from backups,...
  6. Cannot clear Event Viewer logs with .ps1 script

    in Windows 10 Performance & Maintenance
    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...
  7. 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...
  8. 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...
  9. Clear All Event Logs in Event Viewer in Windows

    in Windows 10 Tutorials
    Clear All Event Logs in Event Viewer in Windows: How to: Clear All Event Logs in Event Viewer in Windows How to Clear All Event Logs in Event Viewer in Windows Event Viewer is a tool that displays detailed information as event logs about significant events on your PC. Event logs are special files that record...
  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