A little something about everything

internet marketing and website development made simple..

How to run Syncthing as a windows service, with a tray icon on login

First you will need to download the latest official syncthing application from github here:
https://github.com/syncthing/syncthing/releases 

 

Lets make syncthing run as a service on startup.

IMPORTANT!
Make sure you set a Syncthing GUI password to prevent other users from potentially accessing the console giving them full access to all files. 

Install nssm or another service wrapper. (instructions for nssm to follow)

https://nssm.cc/download 

copy the nssm.exe to the same folder as your syncthing.exe, for added security you can rename nssm.exe to something else.

Using nssm, you can open a command prompt and enter the following command:

cd [path to nssm.exe]

then run

You can replace SyncThingServiceName with whatever name you want to use for your service.
Replace {path} with the actual path to the exe.

nssm install SyncThingServiceName binPath= "{path}\syncthin.exe" start= delayed-auto

It should be setup like this:

on the details tab set the startup type to delayed start.

for the login on tab, in most cases you can leave this as the local system account unless you do not use a GUI password, in which case you will need to setup a specific user account that does not have elevated privileges to prevent a security breach.

!Critical, to prevent data loss or file corruption you need to set the shutdown timeout to 10,000ms. It should look like this:

Exit actions:

If you would like to set error logging or other settings you can do so now.

Click Install Service: 

Next, you need to set a few more final settings to handle upgrades, restarts and unexpected exits correctly. In a command promp enter the following commands:

nssm set SyncThingServiceName AppExit Default Exit
nssm set SyncThingServiceName AppExit 0 Exit
nssm set SyncThingServiceName AppExit 3 Restart
nssm set SyncThingServiceName AppExit 4 Restart

Don't forget to start the service or restart your system.

Finally, in order to add the tray icon, use the syncthingtray application from github here:
https://github.com/Martchus/syncthingtray/releases 

If using the full installer, you should start syncthing before running the installer in order to force it to use the latest version instead of the bundled version included with the package.

Use the first option during the setup and follow the guide.

In some cases the tray icon may not be able to connect because it's using the default path. After you restart, open the tray icon settings here:

Then under "connection" click here:

apply and it should connect.

Thats it, you're done.