#Setting up Filen CLI as a Windows Service on Windows 11
This guide outlines the process of installing and configuring the Filen CLI to run as a Windows service for continuous syncing on a Windows 11 system.
#1. Install Filen CLI
- Download the Windows version of Filen CLI from the official website or GitHub repository.
- Extract the zip file to a permanent location, e.g.,
C:\Program Files\Filen CLI\
. - Rename the executable to
filen.exe
for simplicity. - Add the Filen CLI directory to your system PATH:
- Right-click on ‘This PC’ or ‘My Computer’ and select ‘Properties’.
- Click on ‘Advanced system settings’.
- Click on ‘Environment Variables’.
- Under ‘System variables’, find and select ‘Path’, then click ‘Edit’.
- Click ‘New’ and add the path to the Filen CLI directory (e.g.,
C:\Program Files\Filen CLI\
). - Click ‘OK’ to close all dialogs.
- Verify installation by opening a new Command Prompt and running:
filen --version
#2. Set up Authentication
Create a file named .filen-cli-credentials
in your user profile directory:
- Open Notepad.
- Add your Filen credentials to this file:
your_email@example.com your_password your_2fa_code # If 2FA is enabled
- Save the file as
C:\Users\YourUsername\.filen-cli-credentials
(replaceYourUsername
with your actual Windows username).
Secure the credentials file:
- Right-click on the file, select ‘Properties’.
- Go to the ‘Security’ tab, click ‘Edit’, and ensure only your user account has access.
#3. Create a Windows Service
We’ll use the Non-Sucking Service Manager (NSSM) to create a Windows service:
- Download NSSM from nssm.cc.
- Extract the zip file and copy
nssm.exe
toC:\Windows\System32\
. - Open Command Prompt as Administrator.
- Run the following command to create the service:
nssm install FilenSync "C:\Program Files\Filen CLI\filen.exe" "sync C:\Users\YourUsername\FilenSync:twoWay:/999_SHARED --continuous"
Replace YourUsername
with your actual Windows username and adjust the paths as necessary.
- Set the service to run under your user account:
nssm set FilenSync ObjectName .\YourUsername YourPassword
Replace
YourUsername
andYourPassword
with your actual Windows credentials.
#4. Start the Service
- Open the Services application (services.msc).
- Find the “FilenSync” service.
- Right-click and select “Start”.
To make the service start automatically on boot:
- Right-click the service and select “Properties”.
- Set “Startup type” to “Automatic”.
- Click “Apply” and “OK”.
#5. Verify Service Status
- Open the Services application (services.msc).
- Find the “FilenSync” service.
- Check that its status is “Running”.
#6. Monitor Logs
To view the service logs:
- Open Event Viewer (eventvwr.msc).
- Expand “Windows Logs” and select “Application”.
- Look for events with “FilenSync” as the source.
#Troubleshooting
If you encounter issues:
- Check the service status in the Services application.
- Review the logs in Event Viewer.
- Ensure the sync directories exist and have the correct permissions.
- Verify the credentials in
C:\Users\YourUsername\.filen-cli-credentials
are correct. - Try running the sync command manually to see if there are any errors:
"C:\Program Files\Filen CLI\filen.exe" sync C:\Users\YourUsername\FilenSync:twoWay:/999_SHARED
- If problems persist, check for updates to the Filen CLI or consult the official Filen documentation.
#Maintenance
- Periodically check for updates to the Filen CLI.
- To update, download the new version, replace the executable in
C:\Program Files\Filen CLI\
, and restart the service. - Regularly review and adjust your sync settings as needed.
Remember to keep your .filen-cli-credentials
file secure and update it if you change your Filen account password.