Skip to content

Instantly share code, notes, and snippets.

View Kyleslav's full-sized avatar

Kyle Kyleslav

View GitHub Profile
@ECHO OFF
if not exist "c:\windows\sysmon\" mkdir "c:\windows\sysmon\"
fc c:\windows\sysmon\sysmon_config.xml "\\NETWORK_PATH\sysmon\sysmon_config.xml" > nul
If "%ERRORLEVEL%" GEQ "1" (
copy /z /y "\\NETWORK_PATH\sysmon\sysmon_config.xml" "C:\windows\sysmon\"
sysmon64 -c c:\windows\sysmon\sysmon_config.xml
sc query "Sysmon64" | Find "RUNNING"
If "%ERRORLEVEL%" EQU "1" (
Expand-Archive -LiteralPath \\NETWORK_PATH\winlogbeat-7.8.0-windows-x86_64.zip -DestinationPath 'c:\program files'
$workdir = 'c:\program files\winlogbeat-7.8.0-windows-x86_64'
Set-Location -Path $workdir
Remove-Item winlogbeat.yml
Copy-Item \\NETWORK_PATH\winlogbeat.yml -Destination winlogbeat.yml
if (Get-Service winlogbeat -ErrorAction SilentlyContinue) {
$service = Get-WmiObject -Class Win32_Service -Filter "name='winlogbeat'"
$service.StopService()
Start-Sleep -s 1
$service.delete()