07-06-2005, 04:34 AM
This is a relatively easy thing to do, and you don't have to purchase any programs to do it- the old fashioned srvany approach works perfectly. I will now explain in detail what exactly the srvany approach is.
Before we begin, make sure you're starting your server with a batch (.BAT) file, and that it starts in console mode. This will not work any other way. To do this, simply open notepad, and type this into it:
c:
cd\<The Name of the folder in which your srcds.exe resides>
start /high c:\<The Name of the folder in which your srcds.exe resides>\srcds.exe <-vacbeta> -console -game <gametype- such as cstrike for CS:S> +map de_dust2 -maxplayers <However many players you wish to have>
Save this file as "run.bat" in your Source server directory.
Now, on to making the service.
Step 1: Download INSTSRV.EXE and SRVANY.EXE to a directory you can remember on your windows box. For this example, we will put the files in a folder "service" on the root of the C: drive. (C:\service)
The files can be found on my server at the following addresses:
http://counter.tixen.net/runasservice/instsrv.exe
http://counter.tixen.net/runasservice/srvany.exe
Step 2: Open up a dos prompt (click start, run, type "cmd" and hit enter), and go to the directory in which the two files reside (in our example, you would type "cd\service").
Once in the directory, type "INSTSRV SRCDS c:\service\srvany.exe" (of course replacing c:\service with wherever you put the programs). (You can also rename "SRCDS[" with anything you choose- This is the name of the service as it will appear in your list of services.)
Step 3: Close the DOS window by typing EXIT. Now open Regedit (click Start, Run, and typing "Regedit" and press enter). In the folder structure, open the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
Scroll down until you find your service, (which we named in our example "SRCDS"). Open this folder as well.
Step 4: On the menu bar for regedit, click on the "edit" menu, and select "new" and "key". a new folder will apear. Name it "Parameters". Open the folder, and add a new string value (click edit, new, string value). A file will appear in the folder. Name it "Application". Then, Right click on "Application", and click "modify".
In the Value data box, type in the path to your Source Server's bat file. In our case, it was the default, so we would type C:\hl2server\run.bat
Then click OK.
Your server is now ready to run as a service! Simply open the services control panel (either in control panel/administrative tools, or just click start, run, and type "services.msc" and hit enter).
You can set when your server starts and other such things from this panel- just find your server in the list.
That's it!
NOTE: Due to the hacked nature of this service setup, stopping the service WILL NOT stop the server. To stop the server manually, simply open up the task manager (CTRL+ALT+DELETE), and find SRCDS.EXE and end the task manually.
Let me know if you have any problems! The files I posted are old versions, but they should still do the trick well enough.
Before we begin, make sure you're starting your server with a batch (.BAT) file, and that it starts in console mode. This will not work any other way. To do this, simply open notepad, and type this into it:
c:
cd\<The Name of the folder in which your srcds.exe resides>
start /high c:\<The Name of the folder in which your srcds.exe resides>\srcds.exe <-vacbeta> -console -game <gametype- such as cstrike for CS:S> +map de_dust2 -maxplayers <However many players you wish to have>
Save this file as "run.bat" in your Source server directory.
Now, on to making the service.
Step 1: Download INSTSRV.EXE and SRVANY.EXE to a directory you can remember on your windows box. For this example, we will put the files in a folder "service" on the root of the C: drive. (C:\service)
The files can be found on my server at the following addresses:
http://counter.tixen.net/runasservice/instsrv.exe
http://counter.tixen.net/runasservice/srvany.exe
Step 2: Open up a dos prompt (click start, run, type "cmd" and hit enter), and go to the directory in which the two files reside (in our example, you would type "cd\service").
Once in the directory, type "INSTSRV SRCDS c:\service\srvany.exe" (of course replacing c:\service with wherever you put the programs). (You can also rename "SRCDS[" with anything you choose- This is the name of the service as it will appear in your list of services.)
Step 3: Close the DOS window by typing EXIT. Now open Regedit (click Start, Run, and typing "Regedit" and press enter). In the folder structure, open the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
Scroll down until you find your service, (which we named in our example "SRCDS"). Open this folder as well.
Step 4: On the menu bar for regedit, click on the "edit" menu, and select "new" and "key". a new folder will apear. Name it "Parameters". Open the folder, and add a new string value (click edit, new, string value). A file will appear in the folder. Name it "Application". Then, Right click on "Application", and click "modify".
In the Value data box, type in the path to your Source Server's bat file. In our case, it was the default, so we would type C:\hl2server\run.bat
Then click OK.
Your server is now ready to run as a service! Simply open the services control panel (either in control panel/administrative tools, or just click start, run, and type "services.msc" and hit enter).
You can set when your server starts and other such things from this panel- just find your server in the list.
That's it!
NOTE: Due to the hacked nature of this service setup, stopping the service WILL NOT stop the server. To stop the server manually, simply open up the task manager (CTRL+ALT+DELETE), and find SRCDS.EXE and end the task manually.
Let me know if you have any problems! The files I posted are old versions, but they should still do the trick well enough.