Converting lhwsrv.exe to a Windows Service

You can convert lhwsrv.exe to a Windows Service by following the following steps. However this involves These are not for the faint of heart nor for those not familiar with Registry hacking and DOS boxes. Of course you should back up your system and your Registry before beginning - if you don't know how to do these, click your Back button now. Also this probably only works for Win/XP and Win/Vista - if you have an older operating system, click your Back button now.

  1. Download and install the Windows Server 2003 Toolkit. You may have to search for it, but when I wrote this page, it resided at Of course the best way to search is via Google - try this: Google Windows Server 2003 Toolkit.

    Win/Vista will complain about compatibility issues - ignore that and go ahead with the install - the 2 programs you need work fine on Vista (if you have sufficient privileges).

  2. Open a DOS box: Click Start > Run (or maybe Search for Vista) and enter cmd & click the OK button.

  3. Change to the directory when you installed the Windows Server 2003 Toolkit. If you took the defaults during installation, use the following:

  4. Run the following command where "C:\Program Files\Windows Resource Kits\Tools" should be replaced with the directory where you installed the Windows Server 2003 Toolkit:

  5. The Toolkit install with have added C:\Program Files\Windows Resource Kits\Tools to your Path as the first directory. You will want to remove it (or at least move it). Bring up the Control Panel (Start > Settings > Control Pannel) and double-click the System applet. Find the "Advanced" Tab or "Advanced System Settings" link and click it; then click the Environment Variables button. Scroll down the Environment Variables list in the lower path of the dialog until you find the Path variable. Click Edit, press the Home key, and remove the Toolkit path from the beginning of the value. Click OK all the way out. You must remove the Toolkit from your PATH for Windows/Vista since many of the programs don't work on Vista; you might want to keep it for Win/XP, but do so only if you are sure of what you are doing.

  6. Fire up RegEdit. You can do so by trying the regedit at the DOS box command prompt:

  7. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lhwsrv

  8. Right click on lhwsrv and click select 'new' then 'key.' Name the new key 'Parameters'.

  9. Now double click the Parameters key and right click on the empty space in the right hand pane. Choose 'new' then 'string value'. Name the new value 'Application'.

  10. Now repeat the last step, this time naming the string value 'AppDirectory'.

  11. Double click on 'Application' and give it the location of lhwsrv.exe. For example, if you placed lhwsrv.exe in the c:\bin\ directory, you would type 'c:\bin\lhwsrv.exe'.

  12. Double click on 'AppDirectory' and give it the location of the directory where your lhwsrv.exe can be found. Using the above example, the value here would be 'c:\bin\'

  13. Your Registry should now look something like this (don't worry if the Enum key is not present):

    Your Data will of course be where you have placed lhwsrv.exe rather than c:\l-drive\bin.

  14. You can now close RegEdit.

  15. Fire up the Services applet. You can get to this via Start > Settings > Control Panel. Then look for a Services Applet either in the main window or perhaps in Administrative Tools. You can even try running services.msc or services.exe at your command prompt.

  16. Find lhwsrv in the list and double-click it.

  17. It should look like this (Note that the Path to executable value is listed as C:\Program Files\Windows Resource Kits\Tools\srvany.exe. This is because the srvany file is acting as a carrier for the executable file of the program you chose.):

    Set the Startup Type to Automatic and click Start if necessary and you are done.

Creating your own services - where I learned the above.
Back to Better Surfing
Back to Leigh's Home Page Site Map                   Site Search

This page hosted by
Leigh Brasington / / Revised 23 May 07