Clear All Event Logs in Event Viewer in Windows  

Page 9 of 11 FirstFirst ... 7891011 LastLast

  1. Posts : 23
    Windows 10 64-bit
       #80

    I made a .ps1 file using wevtutil el | Foreach-Object {wevtutil cl "$_"} to run with Power Shell from right-click menu but, it is not working. Any help?

    Clear All Event Logs in Event Viewer in Windows-ps1-script.png
      My Computer


  2. Posts : 79
    Windows 10 x64 21H1
       #81

    Hi, Brink

    I used option one of this tutorial, but I found the command codes as following might useless.

    FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
    IF (%adminTest%)==(Access) goto noAdmin
    Clear All Event Logs in Event Viewer in Windows-clear-eventvwrlogs-codes-useless.png

    I ran the bat without administrator privileges, but the bat didn't go to :noAdmin and show the words as following.
    echo Current user permissions to execute this .BAT file are inadequate.
    echo This .BAT file must be run with administrative privileges.
    echo Exit now, right click on this .BAT file, and select "Run as administrator".

    Q1. Could you please tell me how to modify this two command codes or delete them?

    Q2. Could you please tell me (Access) should change to which word and then the bat would go to :noAdmin?

    Best regards,
    Steven.
      My Computer


  3. Posts : 61,501
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #82

    shiwan0804 said:
    Hi, Brink

    I used option one of this tutorial, but I found the command codes as following might useless.

    FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
    IF (%adminTest%)==(Access) goto noAdmin

    I ran the bat without administrator privileges, but the bat didn't go to :noAdmin and show the words as following.
    echo Current user permissions to execute this .BAT file are inadequate.
    echo This .BAT file must be run with administrative privileges.
    echo Exit now, right click on this .BAT file, and select "Run as administrator".

    Q1. Could you please tell me how to modify this two command codes or delete them?

    Q2. Could you please tell me (Access) should change to which word and then the bat would go to :noAdmin?

    Best regards,
    Steven.
    Hello Steven,

    Did you run the BAT in an elevated account like the built-in Administrator or disabled UAC?

    I tested the same by running the BAT without "Run as administrator", and got the message below as normal from those command lines.

    Clear All Event Logs in Event Viewer in Windows-bat.jpg
      My Computers


  4. Posts : 79
    Windows 10 x64 21H1
       #83

    Brink said:
    Hello Steven,

    Did you run the BAT in an elevated account like the built-in Administrator or disabled UAC?

    I tested the same by running the BAT without "Run as administrator", and got the message below as normal from those command lines.

    Clear All Event Logs in Event Viewer in Windows-bat.jpg
    Thanks for your test, Brink.

    I have only one account in this PC and current account is administrator.

    By the way, I disabled UAC by using the registry keys as following.

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
    "ConsentPromptBehaviorAdmin"=dword:00000000
    "EnableLUA"=dword:00000000
    "PromptOnSecureDesktop"=dword:00000000

    Best regards,
    Steven.
      My Computer


  5. Posts : 61,501
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #84

    shiwan0804 said:
    Thanks for your test, Brink.

    I have only one account in this PC and current account is administrator.

    By the way, I disabled UAC by using the registry keys as following.

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
    "ConsentPromptBehaviorAdmin"=dword:00000000
    "EnableLUA"=dword:00000000
    "PromptOnSecureDesktop"=dword:00000000

    Best regards,
    Steven.
    Ah ok. I'm betting disabling UAC is why the command lines don't work.
      My Computers


  6. Posts : 79
    Windows 10 x64 21H1
       #85

    Brink said:
    Ah ok. I'm betting disabling UAC is why the command lines don't work.
    It might be this cause.

    But, I tested the BAT by default UAC setting, the result is the same.
    The BAT didn't go to :noAdmin and show the words as following.
    echo Current user permissions to execute this .BAT file are inadequate.
    echo This .BAT file must be run with administrative privileges.
    echo Exit now, right click on this .BAT file, and select "Run as administrator".
      My Computer


  7. Posts : 61,501
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #86

    shiwan0804 said:
    It might be this cause.

    But, I tested the BAT by default UAC setting, the result is the same.
    The BAT didn't go to :noAdmin and show the words as following.
    echo Current user permissions to execute this .BAT file are inadequate.
    echo This .BAT file must be run with administrative privileges.
    echo Exit now, right click on this .BAT file, and select "Run as administrator".
    I'm not sure what else it could be since I can't reproduce what you're seeing.
      My Computers


  8. Posts : 79
    Windows 10 x64 21H1
       #87

    Brink said:
    I'm not sure what else it could be since I can't reproduce what you're seeing.
    Hi, Brink.
    The first picture is my current account UAC setting.
    Clear All Event Logs in Event Viewer in Windows-my-current-account-uac-setting.png
    The Second picture is the result of running the BAT.
    Clear All Event Logs in Event Viewer in Windows-result-running-bat.png

    What happened to my Windows 10 x64 20H2?
    Note:
    The current OS is new install and not since 2004 upgrade to 20H2.

    Thanks for your kindly help.
      My Computer


  9. Posts : 61,501
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #88

    shiwan0804 said:
    Hi, Brink.
    The first picture is my current account UAC setting.

    The Second picture is the result of running the BAT.

    What happened to my Windows 10 x64 20H2?
    Note:
    The current OS is new install and not since 2004 upgrade to 20H2.

    Thanks for your kindly help.
    It looks like the command has successfully ran to clear your event logs.
      My Computers


  10. Posts : 79
    Windows 10 x64 21H1
       #89

    Brink said:
    It looks like the command has successfully ran to clear your event logs.
    Before:
    Clear All Event Logs in Event Viewer in Windows-before-running-bat.png
    After :
    Clear All Event Logs in Event Viewer in Windows-after-running-bat.png

    By the way, 存取被拒 means Access denied in English.
    Please you help me again. Thanks a lot.
      My Computer


 

Tutorial Categories

Clear All Event Logs in Event Viewer in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 02:41.
Find Us




Windows 10 Forums