This article discusses how to install and configure the Remote Access Server RustDesk under Windows Server. The guide is written for Windows Server Core but is just as applicable to Windows Server with a GUI.
RustDesk is a remote access rendezvous point server which allows a remote support agent to connect to a remote computer remotely while providing screen sharing, remote control and clipboard support. RustDesk is an open source equivalent to the obnoxiously expensive “TeamViewer”, LogMeIn123 and others.
This article assumes that:
- You have a clean install of Windows Server 2016, 2019 or 2022.
- You are running on Server Core and wish to do everything via the command line (everything in the guide is fully applicable to Server GUI, and can be executed from the command line or manually using the GUI interfaces where appropriate).
- You are running RustDesk on a dedicated server / virtual machine using a dedicated user account
Note: As of writing, it does not seem possible to run RustDesk as a native Windows Service (it immediately exits out if you try to launch it through a service user account). You must either run it manually as an application within a user account or within a user account via the pm2 process manager. Both methods are outlined below.
- You have already configured NAT/PAT port forwards from your router to your virtual machine as appropriate to your environment.
TCP: 21115, 21116, 21117, 21118, 21119
- Download and install the current version of the Visual C++ Runtime 2015 – 2022 Library for x64 (version 14 is the specific version required).
Download: Microsoft Visual C++ Runtime
- It is recommended that you do not use the default administrator account to run RustDesk. If you do not wish to use the Administrator account, create a dedicated user for RustDesk to run with on your domain or on the local machine (recommended).
To create a user on the local machine:
net user <username> <password> /ADD
- To add this user to the Administrators group:
net localgroup Administrators <username> /ADD
- Setup automatic logon to Windows by editing and using the following commands (if you are not on a domain, you can omit DefaultDomainName value)
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /t REG_SZ /v "DefaultUserName" /d "Plex" /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /t REG_SZ /v "DefaultPassword" /d "your_password_here" /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /t REG_SZ /v "DefaultDomainName" /d "your_domain_here" /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /t REG_SZ /v "AutoAdminLogon" /d "1" /f
- Create and enable the necessary firewall rules to allow clients to connect to RustDesk. To do this in PowerShell:
New-NetFirewallRule -Name RustDesk-TCP -DisplayName "RustDesk-TCP" -Description "RustDesk TCP Rules" -Direction Inbound -Protocol TCP -LocalPort 21115-21119 -Action Allow New-NetFirewallRule -Name RustDesk-UDP -DisplayName "RustDesk-UDP" -Description "RustDesk UDP Rules" -Direction Inbound -Protocol UDP -LocalPort 21116 -Action Allow Enable-NetFirewallRule -Name RustDesk-TCP Enable-NetFirewallRule -Name RustDesk-UDP
- Download the latest Windows x64 binary of the RustDesk installer
Download: RustDesk Server
- Create the folder
- Extract hbbr.exe and hbbs.exe into
Using node.js & pm2
If you wish to use node.js and pm2 to manage the process within the user account follow this section. If you do not, skip to the next section.
- Download and install the current version of node.js*. The basic installation is sufficient (without installing Chocolaty). Once installed, log off and then back in again to refresh your path environment variables on any open command and PowerShell prompts.
- Install pm2 process manager by entering the following commands
npm install -g pm2 npm install pm2-windows-startup -g pm2-startup install
- Register the two RustDesk services with pm2
pm2 start "C:\Program Files\RustDesk\hbbs.exe" -- --relay-servers <RelayServerIpOrFqdn>:21117 pm2 start "C:\Program Files\RustDesk\hbbr.exe" pm2 save
Note: If you wish to use a key to provide an additional layer of security for your server. change the first line above to:
pm2 start "C:\Program Files\RustDesk\hbbs.exe" -- --relay-servers <RelayServerIpOrFqdn>:21117 --key <YourKey>
- Test using a RustDesk client
If you made a mistake and need to change the pm2 parameters use the following commands to delete the records
pm2 delete "C:\Program Files\RustDesk\hbbs.exe" pm2 delete "C:\Program Files\RustDesk\hbbr.exe"
Then re-add the entry(s) as in step 10 and re-save by entering
To view the process list enter
- Check that pm2 was successfully able to start the services and to view the current daemon status’ (and use Ctrl + C on the keyboard to close).
pm2 log hbbr pm2 log hbbs
Without using node.js and pm2
If you do not want to use node.js and pm2 to manage your install, you can use my RustDesk Service Scripts to start, stop and restart RustDesk on your server.
Note: The following is only applicable to Server Core. For GUI Windows Server, add a shortcut to
C:\Program Files\RustDesk\Start-RustDesk.cmd in the Startup folder or add an entry to the same file under
- Download my RustDesk tools zip
Download: RustDesk-Tools (1KB)
- Extract the contents of the zip file into
- Use notepad to edit the
Start-RustDesk.cmdscript file and set the value for the relayServer IP/FQDN to match your environment.
If you wish to use a key to secure your server, add
--key <YourKey>to the end of the hbbs.exe line e.g.
start "HBBS-RustDesk" /min "%ProgramFiles%\RustDesk\hbbs.exe" --relay-servers %relayServer%:%relayPort% --key <YourKey>
- Enter the command:
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /t REG_SZ /v "10" /d "C:\Program Files\RustDesk\Start-RustDesk.cmd" /f
- Restart the server and RustDesk should automatically load as two minimised windows in the bottom left of the Server Code screen
- Test using a RustDesk client