Cloudflared update automation
A small Windows maintenance utility for updating the Cloudflare Tunnel connector and restarting its service without repeating the same manual commands. I developed it with AI assistance for my self-hosted infrastructure.
The original utility
The first version checks the installed cloudflared version, attempts the built-in update command, falls back to WinGet when needed, restarts the Windows service and displays the resulting version.
Testing and lessons learned
In July 2026, a test began on version 2026.6.1. The built-in updater reported an update to 2026.7.1 but returned a non-zero exit code, triggering the WinGet fallback. WinGet installed 2026.7.0, and the service restarted successfully. This highlighted why an updater should account for the original installation method and verify the actual installed version instead of relying solely on a command's output or exit code.
Revised updater and validation
The November redesign uses a self-elevating CMD wrapper with embedded PowerShell. It is designed to detect the installation method, select the appropriate update path, validate standalone downloads against published SHA-256 checksums, preserve configuration and credentials, and provide logging, version selection and rollback. Service stability checks and an optional health URL are also included in the design.
I have successfully tested both the original utility and the revised v2 updater on Windows.