Share via

Are there log cleanup scripts

John Lenz 1,741 Reputation points
2021-07-21T19:15:58.927+00:00

Server 2102R2

Are there scripts/tasks to cleanup/delete of log entries? I do it manually but it is very tedious.

Suggestions ,please

Windows for business | Windows Server | User experience | Other
0 comments No comments

Answer accepted by question author

Anonymous
2021-07-22T15:15:26.413+00:00

From PowerShell you can Clear-EventLog
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/clear-eventlog?view=powershell-5.1

--please don't forget to upvote and Accept as answer if the reply is helpful--

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. John Lenz 1,741 Reputation points
    2021-07-22T15:22:56.233+00:00

    Thanks,
    I am trying example 4. Will report back

    Was this answer helpful?

    0 comments No comments

  2. John Lenz 1,741 Reputation points
    2021-07-22T15:03:07.32+00:00

    I am looking to clear out event logs

    Was this answer helpful?

    0 comments No comments

  3. Teemo Tang 11,501 Reputation points
    2021-07-22T01:25:24.507+00:00

    Which type of logs do you want to clear? Event log, IIS log or WSUS log? We need more detailed information to assist you with demand.
    In general, if you want to an event log cleanup script, please refer to this Microsoft document
    Clear-EventLog
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/clear-eventlog?view=powershell-5.1

    If you want to cleaup IIS log, refer to this article:
    How to: Cleanup IIS Log Files
    https://community.spiceworks.com/how_to/85462-cleanup-iis-log-files

    -------------------------------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

  4. Anonymous
    2021-07-21T19:41:04.823+00:00

    Not sure what logs you're asking about. You may need to roll your own or take a look here for some examples / ideas.
    https://learn.microsoft.com/en-us/samples/browse/

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    Was this answer helpful?

    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.