Skip to content

Instantly share code, notes, and snippets.

View LM-CT's full-sized avatar

Lucas Cloud Target LM-CT

View GitHub Profile
@LM-CT
LM-CT / SysmonArchiveManager.ps1
Last active May 23, 2024 15:33
A simple script to manage Sysmon logs adapted from NVISO
$ErrorActionPreference = "Stop"
# Define the Sysmon archive path, desired quota and query delay.
$Archive_clean = "C:\Sysmon\"
$Archive = $Archive_clean.Replace("\", "\\")
$Limit = 2GB
$Delay = 10
$FilterName = "SysmonArchiveWatcher"
Write-Verbose "New WMI filter: $FilterName"
@LM-CT
LM-CT / New-SysmonArchiveQuota.ps1
Last active May 21, 2024 16:43 — forked from zbalkan/New-SysmonArchiveQuota.ps1
If you use Sysmon and enabled FileDelete events started with Sysmon 11, you probably came up with the issue of instantly growing hidden archive. For those who have not solved the problem yet, I came up with a PowerShell cmdlet (run as SYSTEM) based on the article https://blog.nviso.eu/2022/06/30/enforcing-a-sysmon-archive-quota/
#Requires -RunAsAdministrator
<#
.Synopsis
Generates Sysmon Archive file quota for `File Delete` events to help managing the size.
.DESCRIPTION
Based on: https://blog.nviso.eu/2022/06/30/enforcing-a-sysmon-archive-quota/
.INPUTS
None. Cmdlet does not accept pipe values.
.OUTPUTS
<?xml version="1.0" encoding="UTF-8"?>
<MitigationPolicy>
<SystemConfig>
<SEHOP Audit="true"/>
</SystemConfig>
<AppConfig Executable="iexplore.exe">
<ImageLoad AuditImageLoad="true"/>
<Payload AuditEnableExportAddressFilter="true"
AuditEnableExportAddressFilterPlus="true"
AuditEnableImportAddressFilter="true"