Controlling the Freelancer server with an NT service
To run the Freelancer server as an NT service, follow the steps below:
Step 1: download flmonitor
Download flmonitor 1.3 and extract flmonitor.exe anywhere you like. The game directory is as good a place as any.
Step 2: install the service
Open up a command prompt (by opening the start menu, selecting Run and typing cmd) and cd into the directory where you copied flmonitor.exe.
For example:
cd "e:\games\freelancer\exe"
Please note that the quotes are REQUIRED if the path contains spaces...
Next, type
flmonitor install
This will pop up the installation dialogue:
Use the Browse button to locate the game server then click Install service to install the service.
Before completing the installation, you can change the startup options by editing the text in the Options box. /p2302 is the default, meaning run the server on (default) port 2302. If you want to run the server on a different port, change this. Please note that you do not need to add the /c flag to bypass the configuration screen. flmonitor always adds it for you.
If you want to run multiple servers on multiple ports, change the value of the Service name (for example to "Freelancer2304").
Step 3: configure the service
Still in your command prompt window, bring up the services manager by typing
services.msc
This will bring up the list of installed services. Open the Freelancer service and select the Log On tab. Make sure that the server is set to run under the LocalSystem account and that "Allow service to interact with the desktop" is checked.
Now start the service, accept the EULA and configure your server. Close down the server once you've set it up and start the service again. If all went well the configuration window should be skipped this time and the server should start up immediately.
You can now remove the ability to interact with the desktop from the service (by unchecking the box in the services manager). Upon restarting the service, the server console should not be displayed at all. Test that it works by connecting up to your server!
Step 4: managing user accounts
Because the server runs as LocalSystem, and because server configuration settings are unique to the user running the server, you will have to copy over your existing accounts and settings if you had previously run a server under your own account.
Under Windows 2000, the server should store its files in C:\Documents and Settings\Default User\My Documents\My Games\Freelancer\Accts\Multiplayer.
Under Windows XP (and possibly Server 2003), the server should store its files in C:\Documents and Settings\LocalService\My Documents\My Games\Freelancer\Accts\Multiplayer.
Your own account files can be found in %USERPROFILE%\My Documents\My Games\Freelancer\Accts\Multiplayer (yes just type that into Explorer).
If you can't find the profiles, you can run the service under your own user account. Configure this in the services manager by setting the service to Log on as you; ie enter your username and password in the boxes.
If you do this, be aware that you can't allow the server to interact with the desktop, so you must run the server manually at least once in order to configure it.
Another possible solution to this problem, suggested by Limer.pmm, is to edit the registry, changing both HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal and HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal to the My Documents directory of the user with the right configuration.
Removing the service
You can remove the service at any time by typing
flmonitor remove
The following dialogue shows, asking you to enter the service name.
You will be asked to confirm your decision to remove the service before any action is taken. Please note that if you have the services management console open you should close it down after removing a service or you won't be able to add a new service with the same name.
Credits
Thanks to RevRaz for uncovering the /c switch I was looking for.
Kevin Spousta provided valuable feedback.
Jump to a section
intro | part 1: Creating an NT service | part 2: Installing the service