Applications/nxlog/nxlog_setup.ps1
2024-07-07 08:19:22 +02:00

19 lines
760 B
PowerShell

#
$fichier1 = "nxlog-ce-3.2.2329.msi"
$url1 = "https://nxlog.co/system/files/products/files/348/nxlog-ce-3.2.2329.msi"
$file1 = "C:\tmp\"+$fichier1
$url2 = "https:///nxlog.conf"
$file2 = "C:\Program Files\nxlog\conf\nxlog.conf"
$SERVER_IP = Read-Host -Prompt 'What is the IP of your syslog server? '
# Download and install nxlog
(New-Object -TypeName System.Net.WebClient).DownloadFile($url1, $file1)
Start-Process C:\Windows\System32\msiexec.exe -ArgumentList "/i $file1 /q" -wait
# Download and modify nxlog configuration and restart nxlog
(New-Object -TypeName System.Net.WebClient).DownloadFile($url2, $file2)
(Get-Content "C:\Program Files (x86)\nxlog\conf\nxlog.conf").replace("CHANGEME", $SERVER_IP) | Set-Content $file2
Restart-Service -Name nxlog