Advertisement
hl2guide

Malware Scan using ESET 1.0A - PowerShell

Jan 10th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Scans a computer using ESET - https://help.eset.com/eis/11/en-US/advanced_cmd.html
  2. # Requires: ESET Security (latest stable version)
  3. # Version: 1.0A
  4.  
  5. # Edit this to where you have ESET Security installed
  6. $esetEXE = 'C:\Program Files\ESET\ESET Security\ecls.exe'
  7.  
  8. # End edits
  9.  
  10. $process = $esetEXE
  11.  
  12. $StartTime = $(get-date)
  13. Write-Host 'Start Time:'$StartTime -ForegroundColor Magenta
  14.  
  15. # Run scan
  16. $arguments = '/files /memory /boots /sfx /suspicious /unwanted /unsafe'
  17. $process = Start-Process $esetEXE -ArgumentList $arguments -PassThru
  18. $process.WaitForExit()
  19.  
  20. $result = $process.ExitCode
  21.  
  22. if($result -eq 0)
  23. {
  24.     Write-Host 'No malware found :D' -ForegroundColor Green
  25. }
  26. elseif(($result -eq 1) -or ($result -gt 50))
  27. {
  28.     Write-Host 'Malware found, check again with GUI version of ESET or other malware scanner :S' -ForegroundColor Red
  29. }
  30. else
  31. {
  32.     Write-Host 'Threat found and cleaned :D' -ForegroundColor Yellow
  33. }
  34.  
  35. $elapsedTime = $(get-date) - $StartTime
  36.  
  37. $totalTime = "{0:HH:mm:ss}" -f ([datetime]$elapsedTime.Ticks)
  38. Write-Host 'Time taken:'$totalTime -ForegroundColor Magenta
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement