This guide explains how to upgrade the Beszel Agent on Windows systems when installed via WinGet.
WinGet uses versioned installation paths that change during upgrades.
When this happens, the NSSM service will still point to the old path, causing the upgrade or service restart to fail.
The simplest method is to run the upgrade script:
& iwr -useb https://get.beszel.dev/upgrade -OutFile "$env:TEMP\upgrade-agent.ps1"; & Powershell -ExecutionPolicy Bypass -File "$env:TEMP\upgrade-agent.ps1"The script will:
- Check if the service exists
- Upgrade the agent using your package manager (Scoop or WinGet)
- Compare the old and new executable paths
- Update the NSSM service configuration if the path changed
- Restart the service with the new path
If you prefer to do it manually:
- Upgrade the package:
winget upgrade --exact --id henrygd.beszel-agent- Find the new executable path:
# Check if it's in PATH:
Get-Command beszel-agent
# Or search common locations:
Get-ChildItem -Path "$env:ProgramFiles\WinGet\Packages\henrygd.beszel-agent*\beszel-agent.exe"- Update the NSSM service (requires admin privileges):
# Stop the service
nssm stop beszel-agent
# Update the application path
nssm set beszel-agent Application "C:\new\path\to\beszel-agent.exe"
# Start the service
nssm start beszel-agentWe have a wrapper script that can be used to automate the upgrade process. It is available in the supplemental/scripts directory of our GitHub repository.
If GitHub is blocked in your country, you can download the wrapper script at get.beszel.dev/upgrade-wrapper. If the raw.githubusercontent.com URL in the script is blocked, change it to https://get.beszel.dev/upgrade.
You can set up automated upgrades using Windows Task Scheduler:
- Create a new task that runs daily or weekly
- Set it to run with highest privileges (required for NSSM)
- Configure it to run the upgrade script:
powershell.exe -ExecutionPolicy Bypass -File "C:\path\to\upgrade-agent-wrapper.ps1"
For enterprise environments, you can deploy the upgrade script via Group Policy:
- Place the upgrade script in a network share
- Create a Group Policy that runs the script as a scheduled task
- Configure appropriate execution permissions
If the service fails to start after an upgrade:
- Check the service configuration:
nssm get beszel-agent ApplicationOr with the GUI:
nssm edit beszel-agent- Verify the path exists:
Test-Path "C:\path\shown\by\previous\command\beszel-agent.exe"- Find the correct path:
Get-ChildItem -Path "$env:ProgramFiles\WinGet\Packages\henrygd.beszel-agent*\beszel-agent.exe" -Recurse- Update the service path:
nssm set beszel-agent Application "C:\correct\path\to\beszel-agent.exe"
nssm start beszel-agentIf you encounter permission issues:
- Ensure you're running PowerShell as Administrator
- Check that NSSM is accessible (should be in PATH or specify full path)
- Verify the beszel-agent executable is accessible
If the agent executable cannot be found after upgrade:
- Refresh your PATH environment variable:
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")- Search for the executable manually:
Get-ChildItem -Path "$env:ProgramFiles" -Recurse -Name "beszel-agent.exe" -ErrorAction SilentlyContinue
Get-ChildItem -Path "$env:LOCALAPPDATA" -Recurse -Name "beszel-agent.exe" -ErrorAction SilentlyContinueIf you continue to experience issues with upgrades:
- Check GitHub Issues and Discussions for similar problems
- Review the service logs at
%ProgramData%\beszel-agent\logs\beszel-agent.log - Use
nssm status beszel-agentto check service status - Use
nssm edit beszel-agentto edit the service configuration