2025-01-29 09:11:16 +01:00
2025-01-19 15:43:51 +01:00
2025-01-19 16:07:18 +01:00
2025-01-22 11:18:57 +01:00
2025-01-29 09:11:16 +01:00
2025-01-19 17:56:58 +01:00
2025-01-19 16:07:46 +01:00
2025-01-19 17:56:58 +01:00

BeszelWin

A collection of four scripts to build, install, update or uninstall the Beszel agent under Microsoft Windows, inspired by Using Beszel to monitor Windows and a video on the Tailscale channel by Alex Kretschmar.

(1) Building the executable

Prerequisites

  • Microsoft Windows 10 or later Client OS (64 bit)

Building under Windows Server OS should be working, but you have to install Go and Git manually as Winget is not available for Windows server operating systems.

Compiling

Download and extract install-beszel-service.zip.

Open a cmd.exe shell, cd into the script directory (where you extracted the archive) and start the build-script:

.\build_agent.cmd

The script will install Git and Go (if not yet installed) with Winget, clone the Beszel repository and build a Windows 64 bit agent.exe binary.

C:\Users\User\Downloads\install-beszel-service>build_agent.cmd
This script downloads the Beszel repository and builds the Beszel agent for Windows (64 Bit only).
If not yet installed, Git and Go will be installed via Winget.

Winget executable found
Installing Go with Winget
Installing Git with Winget
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
Cloning Beszel repository
Building agent
Build successful
Beszel agent.exe was built and copied, you can proceed with 'install-beszel-service.cmd'.

(2) Installing the service

Prerequisites

  • Microsoft Windows 10 or later - Server OS should work, too

Installation

Open a cmd.exe shell with administrative rights and cd into the script directory (where you extracted the archive).

If you have built the agent by yourself: Copy your agent.exe binary to the directory where you extracted the scripts. Overwrite agent.exe from the archive.

Example:

copy /y .\beszel\beszel\cmd\agent\agent.exe .

Start the installation script provided with your Beszel Ssh key:

.\install-beszel-service.cmd <your Beszel ssh key>

The script copies agent.exe into the directory %ProgramFiles%\BeszelAgent and takes usage of NSSM - the Non-Sucking Service Manager to install the service. If NSSM is not yet installed on your system, it will be downloaded and installed to the Beszel agent directory.

The provided agent.exe was compiled on January, 17th 2025 by me and should be exchanged by a self compiled or official executable, see (1) Building the executable.

For more details, see Using Beszel to monitor Windows by Alex Kretschmar.

C:\Users\User\Downloads\install-beszel-service>install-beszel-service.cmd ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwRj3l7U9QUJM2K8p2mkH8KDJmhpMwejuPci4LtGxEz
This script installs the Beszel agent for Windows.
If not yet installed, NSSM will be installed via Winget.

Checking adminstrative rights
Administrative rights check OK
Creating directory C:\Program Files\BeszelAgent
Downloading NSSM
Extracting ZIP file
Copying nssm.exe to C:\Program Files\BeszelAgent
Deleting temporary files and directories
Copying agent.exe to C:\Program Files\BeszelAgent
Adding firewall rule
Installing service BeszelAgent
Setting environment for BeszelAgent
Starting BeszelAgent
BeszelAgent: START: The operation completed successfully.
Display service status
NSSM dump:
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" install BeszelAgent "C:\Program Files\BeszelAgent\agent.exe"
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" set BeszelAgent AppDirectory "C:\Program Files\BeszelAgent"
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" set BeszelAgent AppExit Default Restart
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" set BeszelAgent AppEnvironmentExtra ":KEY=ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwRj3l7U9QUJM2K8p2mkH8KDJmhpMwejuPci4LtGxEz"
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" set BeszelAgent DisplayName BeszelAgent
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" set BeszelAgent ObjectName LocalSystem
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" set BeszelAgent Start SERVICE_AUTO_START
^"^\^"C:^\Program Files^\BeszelAgent^\nssm.exe^\^"^" set BeszelAgent Type SERVICE_WIN32_OWN_PROCESS
Wait 5 seconds, check service status
SERVICE_RUNNING

(3) Updating the service

Prerequisites

  • To update the Beszel agent, it has to be installed using the install script.

Updating

Open a cmd.exe shell with administrative rights and cd into the script directory (where you extracted the archive).

Start the update by launching

.\update_agent.cmd

The update will make a fresh clone of the Beszel GitHub repository, build the executable, stop the agent service, copy the new agent.exe to %ProgramFiles%\BeszelAgent and start the service.

(4) Uninstall the service

Prerequisites

  • To uninstall the Beszel agent, it has to be installed using the install script.

Uninstalling

Open a cmd.exe shell with administrative rights.

Start the update by launching

.\uninstall_agent.cmd

The script will stop and remove the Beszel service and delete the installation directory %ProgramFiles%\BeszelAgent.

Description
Installation des Beszel Agents unter Windows als Service
Readme 6.7 MiB
1.02 Latest
2025-01-28 10:21:19 +01:00
Languages
Batchfile 100%