Upgrading with WinGet
Work in progress
This is currently being tested with the 0.12.0 release. If the upgrade fails, please check back later.
The WinGet path issue
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.
Upgrade methods
Method 1: Upgrade script
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
Method 2: Re-run installation script
Re-running the installation script with your key should work for the time being.
& iwr -useb https://get.beszel.dev -OutFile "$env:TEMP\install-agent.ps1"; & Powershell -ExecutionPolicy Bypass -File "$env:TEMP\install-agent.ps1" -Key "your-ssh-key-here"
Method 3: Manual upgrade process
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-agent
Automated upgrades
We 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
.
Using Windows Task Scheduler
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"
Using Group Policy (enterprise)
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
Troubleshooting
Service won't start after upgrade
If the service fails to start after an upgrade:
- Check the service configuration:
nssm get beszel-agent Application
- 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-agent
Permission issues
If 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
Path not found
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 SilentlyContinue
Support
If 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-agent
to check service status - Run the upgrade script with verbose output for debugging