Last active
January 7, 2026 09:49
-
-
Save CreativeWolf/8e044c99c4337eceda34659f52dfbdde to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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