TFTP as a service HOWTO

By Zach Forsyth (Zach.Forsyth AT kiandra.com), April 2004.
Edited by Mike Eriksen

Microsoft Windows servers include a "remote installation service" (RIS), which is a tftp server (a "tftpd") that runs as a service, which is nice. However the only options you have to configure RIS is to change a registry key directly that locates the files it serves. There is no logging, there is no other way to configure it at all. In my opinion there are other and better ways to install a tftpd service than using RIS as there are multiple free tftp servers that can be installed as a service using the Microsoft Windows resource kit tools. That should in my opinion be the way forward for Thinstation end users.

I have just written a very quick guide to installing a program as a service using the resource kit. It may need some fine tuning for ease of use, but here goes:

HOW TO INSTALL YOUR TFTP SERVER AS A SERVICE:

Requirements:

The following programs from the Microsoft Windows NT4/2000/2003 resource kit:

Description

The srvany.exe utility is distributed by Microsoft as part of their Resource Kit for Windows NT4/2000/2003. Included with this utility is instsrv.exe that is used to install services. A service is similar to a background process on Unix.

The advantages of running as a service include:

  • The application can start with the system boot, without a user logon.
  • The application can stay running while users logon and logout.
  • The application can be configured to not interact with the user's display.
  • The application can use a different logon account with different security credentials than the logged in user.

Using these directions You can install your own application to run as a service.

Directions

Here are the steps to configure a tftpd service:

Copy instsrv.exe and srvany.exe to a local directory on the machine you wish to run the tftpd service. Open a command prompt and browse to the location srvany and instsrv are located.

instSrv uses the following syntax to install SrvAny and create a service name:

   instsrv ServiceName %windir% :\Path\srvany.exe

Parameters

  • %windir% - Specifies the root system directory, such as C.
  • Path - Specifies the full path to the location of Srvany.exe.
  • ServiceName - Specifies the name you want to assign the service. (eg. "tftpd32service")

If the service was successfuly installed the following information will be displayed:

Output similar to the following is displayed: The service was successfully added! Make sure that you go into the Control Panel and use the Services applet to change the Account Name and Password that this newly installed service will use for its Security Context.

Configure the Service

After you install SrvAny and create a service name, you must configure the service. To configure a service you must specify a target application, an account name, and password for the service to use. Then you can configure optional settings such as startup parameters and a default working directory.

You can configure your service either in the MMC Services snap-in or the registry.

RegEdit

Caution - The registry editors bypass standard safeguards, allowing settings that can degrade performance, damage your system, or even require you to reinstall Windows.

If you must edit the registry directly, back it up first. Read the Registry Editor Help for more information.

To configure a service in RegEdit:

  • Click the Start button, and then click Run.
  • In the Open box, type regedit, and click OK.
  • Add a new subkey named Parameters in the following registry location:
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
  • Right-click the newly created service name that you created when installing srvany (eg. "tfptd32service"), point to New, and then click Key.
  • In the console pane, for the name of the new key, type Parameters.
  • To specify the target application, right-click the Parameters subkey, point to New, and then click String Value.
  • Type the name of the new entry as Application.
  • Right-click Application and then click Modify.
  • In the Edit String window, in Value Data, type the full path to the application, including the application name and extension (for example: C:\tftp\tftpd32.exe).

You can now start the "tftp32service" manually using the Services application in the Control Panel.

Check that its working OK. You can now also set a whole range of options from within the Services application.

That should be it. Enjoy!

You can install SrvAny several times to create different services that use different registry settings and run different target applications. If you are installing srvany multiple times, you must use a distinct service name for each instance you install. For example, for different applications you want to run as a service, you can just use DatabaseService, and for e-mail applications, use EmailService.