How can I delete old Windows event logs

Jimmy Afflick 100 Reputation points
2024-07-29T12:44:04.46+00:00

Hi Experts,

Windows server run out of space on C drive due to GPO that doesn't delete old event logs.
Could someone please let me know how to delete old event logs via GPO

I am looking forward to hearing from you

Regards
Leo

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dominique Schluep 410 Reputation points
    2024-07-30T11:50:06.1266667+00:00

    Hello Jimmy Afflick

    You could do that with PowerShell:

    #Clear Specific Log
    Clear-EventLog -LogName LogName
    
    #Clean All Logs
    Get-EventLog -LogName * | ForEach {Clear-EventLog $_.Log}
    

    Deleting old Windows event logs can be beneficial in certain situations, but it also has potential downsides, such as the loss of historical data, issues with security audits, and hindering troubleshooting efforts.

    Kind regards
    Dom

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.