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.
- using a Command Prompt (aka DOS box)
- changing you PATH
- editing your registry
- fooling with Services
- Download and install the Windows Server 2003 Toolkit. You may have to search microsoft.com for it, but when I wrote this page, it resided at http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en. Of course the best way to search microsoft.com 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).
- Open a DOS box: Click Start > Run (or maybe Search for Vista) and enter cmd & click the OK button.
- Change to the directory when you installed the Windows Server 2003 Toolkit. If you took the defaults during installation, use the following:
C:\Windows>cd C:\Program Files\Windows Resource Kits\Tools
- 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:
C:\Program Files\Windows Resource Kits\Tools>instsrv.exe lhwsrv "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"
- 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.
- Fire up RegEdit. You can do so by trying the regedit at the DOS box command prompt:
C:\Program Files\Windows Resource Kits\Tools>regedit
Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lhwsrv
- Right click on lhwsrv and click select 'new' then 'key.' Name the new key 'Parameters'.
- 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'.
- Now repeat the last step, this time naming the string value 'AppDirectory'.
- 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'.
- 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\'
- 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.
You can now close RegEdit.
- 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.
- Find lhwsrv in the list and double-click it.
- 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
This page hosted by
/ Revised 23 May 07