Skip to content

Instantly share code, notes, and snippets.

@CreativeWolf
Last active January 7, 2026 09:49
Show Gist options
  • Select an option

  • Save CreativeWolf/8e044c99c4337eceda34659f52dfbdde to your computer and use it in GitHub Desktop.

Select an option

Save CreativeWolf/8e044c99c4337eceda34659f52dfbdde to your computer and use it in GitHub Desktop.
# Define the target version and URL
$TargetVersion = "2.3.0"
$DownloadUrl = "https://github.com/zeek/zeek-agent-v2/releases/download/v$TargetVersion/zeek-agent-$TargetVersion.msi"
$MsiPath = "$env:TEMP\zeek-agent-$TargetVersion.msi"
# Function to get currently installed Zeek-Agent version
function Get-ZeekVersion {
$ver = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.DisplayName -like "*Zeek-Agent*" } |
Select-Object -ExpandProperty DisplayVersion -ErrorAction SilentlyContinue
return $ver
}
$CurrentVersion = Get-ZeekVersion
if ($null -eq $CurrentVersion -or [version]$CurrentVersion -lt [version]$TargetVersion) {
Write-Output "Installing/Upgrading Zeek-Agent to $TargetVersion. (Current: $CurrentVersion)"
# Download MSI
Invoke-WebRequest -Uri $DownloadUrl -OutFile $MsiPath
# Silent Installation
Start-Process msiexec.exe -ArgumentList "/i `"$MsiPath`" /qn /norestart" -Wait
# Cleanup
Remove-Item $MsiPath -ErrorAction SilentlyContinue
Write-Output "Installation complete."
} else {
Write-Output "Zeek-Agent is already up to date ($CurrentVersion)."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment