New
#1
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 "$_"}
Attachment 231000Attachment 231001Attachment 231002