From f26ae18f48ead1da87d7fd844cd219c19cd666cf Mon Sep 17 00:00:00 2001 From: Dylane Bengono Date: Wed, 11 Sep 2024 08:09:10 +0100 Subject: [PATCH] refactor: Register Snort as a scheduled task to run at startup --- scripts/windows/snort.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/windows/snort.ps1 b/scripts/windows/snort.ps1 index cc95027..c1c2d09 100644 --- a/scripts/windows/snort.ps1 +++ b/scripts/windows/snort.ps1 @@ -90,9 +90,15 @@ function Install-Snort { Write-Host "Failed to download snort.conf file." } - #delete temp directory + # Delete temp directory Remove-Item -Path $tempDir -Recurse -Force + # Register Snort as a scheduled task to run at startup + $taskName = "SnortStartup" + $taskAction = New-ScheduledTaskAction -Execute "C:\Snort\bin\snort.exe" -Argument "-c C:\Snort\etc\snort.conf -A full -l C:\Snort\log\ -i 5 -A console" + $taskTrigger = New-ScheduledTaskTrigger -AtStartup + Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -RunLevel Highest + Write-Host "Installation and configuration completed!" }