Advertisement
alice_killer

WAZUH SCRIPTS

May 31st, 2023 (edited)
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #CERT
  2. Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-4.4.0-1.msi -OutFile  'C:\Program Files (x86)\wazuh-agent-4.4.0-1.msi'; msiexec.exe /i 'C:\Program Files (x86)\wazuh-agent-4.4.0-1.msi' /q WAZUH_MANAGER='192.168.0.88' WAZUH_REGISTRATION_SERVER='192.168.0.88' WAZUH_AGENT_GROUP='Cert'
  3. Start-Sleep  -Seconds 60
  4. Write-Host "Downloaded and installed"
  5. Start-Sleep  -Seconds 3
  6. Write-Host "Restarting Wazuh service..."
  7. Start-Sleep  -Seconds 3
  8. Restart-Service WazuhSvc
  9. Start-Sleep  -Seconds 30
  10. Remove-Item 'C:\Program Files (x86)\wazuh-agent-4.4.0-1.msi'
  11.  
  12. #IB
  13. Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-4.4.0-1.msi -OutFile  'C:\Program Files (x86)\wazuh-agent-4.4.0-1.msi'; msiexec.exe /i 'C:\Program Files (x86)\wazuh-agent-4.4.0-1.msi' /q WAZUH_MANAGER='192.168.0.88' WAZUH_REGISTRATION_SERVER='192.168.0.88' WAZUH_AGENT_GROUP='IB'
  14. Start-Sleep  -Seconds 60
  15. Write-Host "Downloaded and installed"
  16. Start-Sleep  -Seconds 3
  17. Write-Host "Restarting Wazuh service..."
  18. Start-Sleep  -Seconds 3
  19. Restart-Service WazuhSvc
  20. Start-Sleep  -Seconds 30
  21. Remove-Item 'C:\Program Files (x86)\wazuh-agent-4.4.0-1.msi'
  22.  
  23. #control wazuh in server  /var/ossec/bin/manage_agents
  24.  
  25. #INSTALLING FROM LOCAL MACHINE AND WITH CONDITION FOR CHECKING FILE FOR EXISTING
  26.  
  27. $Source = '\\smbserver\shares\A\Wazuh\wazuh-agent-4.4.0-1.msi'
  28. $Destination = '${env:tmp}\wazuh-agent-4.4.0-1.msi'
  29.  
  30. if (Test-Path -Path $Source) {
  31.     Write-Output "Installing..."
  32.     Start-Sleep  -Seconds 10
  33.     Copy-Item -Path $Source -Destination $Destination -Force; msiexec.exe /i '${env:tmp}\wazuh-agent-4.4.0-1.msi' /q WAZUH_MANAGER='192.168.0.88' WAZUH_REGISTRATION_SERVER='192.168.0.88' WAZUH_AGENT_GROUP='Cert'
  34.     Start-Sleep  -Seconds 30
  35.     Write-Host "Installed"
  36.     Start-Sleep  -Seconds 3
  37.     Write-Host "Restarting the Service..."
  38.     Start-Sleep  -Seconds 3
  39.     Restart-Service WazuhSvc
  40.     Start-Sleep  -Seconds 3
  41.     Set-service WazuhSvc -StartupType Automatic
  42.     Start-Sleep  -Seconds 30
  43.     Remove-Item '${env:tmp}\wazuh-agent-4.4.0-1.msi'
  44.     Start-Sleep  -Seconds 5
  45.     Write-Host "The installation is successfully completed"
  46. } else {
  47.     Write-Output "Error: The specified file not found!"
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement