This article explains how to properly remove the Sysmon (or Sysmon64) service and the Wazuh Agent from a Windows system using the SOCFortress uninstall script.
The PowerShell script automates cleanup by:
The uninstall script is hosted in the official SOCFortress GitHub repository:
https://raw.githubusercontent.com/socfortress/Wazuh-Rules/refs/heads/main/prexisting_sysmon_wazuh_uninstall.ps1
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/socfortress/Wazuh-Rules/refs/heads/main/prexisting_sysmon_wazuh_uninstall.ps1" -OutFile "$env:TEMP\prexisting_sysmon_wazuh_uninstall.ps1"
PowerShell -ExecutionPolicy Bypass -File "$env:TEMP\prexisting_sysmon_wazuh_uninstall.ps1"
Optionally, you can include the -Transcript switch to generate a log file in %TEMP%:
-Transcript
%TEMP%
PowerShell -ExecutionPolicy Bypass -File "$env:TEMP\prexisting_sysmon_wazuh_uninstall.ps1" -Transcript
-u force
Wazuh Agent
C:\Program Files (x86)\ossec-agent
You should see green success messages such as:
Sysmon removed cleanly (exit code 0) Wazuh Agent removed cleanly. ✅ Cleanup completed successfully.
This script must be run from an elevated prompt
%TEMP%\sysmon_uninstall_*.log
This script makes no changes outside of Sysmon and Wazuh components. It should only be executed on hosts where these agents were intentionally deployed.
Was this article helpfu?
Thank you for voting
You are related to multiple companies. Please select the company you wish to login as.