Created
April 23, 2025 06:46
-
-
Save cryptrz/a309d06be39ec0bac60c918e26a69dd0 to your computer and use it in GitHub Desktop.
Remove Sysmon logs older than 30 days
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove-SysmonOldLogs.ps1 | |
$Folder = "C:\Sysmon" | |
$Days = 30 | |
Get-ChildItem -Path $Folder -Recurse -File | Where-Object { | |
($_.LastWriteTime -lt (Get-Date).AddDays(-$Days)) | |
} | Remove-Item -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment