When I was un/installing a service on a server I had to use the installutil utility from the .Net framework. I encoutered some problems with this.
1) 'Installutil' is not recognized as an internal or external command,
operable program or batch file.
Solution: The .NET path is not added to the environment variable by default. To use
this tool either navigate to the folder where .NET is installed into (i.e.
c:\windows\Microsoft.NET\framework\..), or open the command prompt that is installed
with VS.NET which sets the environment correctly.
2) Exception occurred while initializing the installation:
System.BadImageFormatException: The format of the file 'device_manager.exe'
This means that the installutil that is used by default is the wrong version of the .Net framework. You can browse to the folder of the correct framework and run the installutil from there.
There are several folders available for the different frameworks. Use the highest version your assembly is compiled in. The folders are situated under: (systemdrive):\WINDOWS\Microsoft.NET\Framework and can be the following: