Skip to content

Instantly share code, notes, and snippets.

@jymcheong
Last active February 19, 2025 15:25
Show Gist options
  • Save jymcheong/f06fc33d009fba056050ffc70cdf96f1 to your computer and use it in GitHub Desktop.
Save jymcheong/f06fc33d009fba056050ffc70cdf96f1 to your computer and use it in GitHub Desktop.
Auto-install Nxlog with Chocolatey Package Manager
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
iex "choco install nxlog -y"
$client = New-Object System.Net.WebClient
# download & save the correct nxlog config which includes Sysmon, Nxlog WILL FAIL if Sysmon is not installed
if ([System.IntPtr]::Size -eq 4) { # I also assumed no change in default install paths
$url = "https://raw.githubusercontent.com/jymcheong/SysmonResources/master/6.%20Sample%20Data/nxlog.conf32.txt"
$path = "C:\Program Files\nxlog\conf\nxlog.conf"
} else {
$url = "https://raw.githubusercontent.com/jymcheong/SysmonResources/master/6.%20Sample%20Data/nxlog.conf64.txt"
$path = "C:\Program Files (x86)\nxlog\conf\nxlog.conf"
}
$client.DownloadFile($url, $path)
# restart nxlog service
Restart-Service -Name nxlog
@jymcheong
Copy link
Author

jymcheong commented Apr 13, 2018

Need admin rights. Tested on Win7ent 32bit & win10-64bit.

@bish0polis
Copy link

dead URL in script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment