If need to install a window service on a server where Visual Studio is not installed or you don’t have Visual Studio tools then follow the steps below
1) You can find InstallUtil.exe at following directory
C:\Windows\Microsoft.NET\Framework64\v4.0.30319 (depending on system it could be a bit different but usually you will find under Framework > version)
2) Now open command prompt (run as admin)
3) copy following command and run it
Go to InstallUtil folder first by typing
then Type following command and press enter
This will install window service for you.
In some case you might get an error like below
Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\ABCDevelopment\MyServiceWS.exe' or one of its dependencies. Operation is not s
upported. (Exception from HRESULT: 0x80131515).
To fix this go to your service.exe (in my case MyServiceWS.exe) file, click on properties and in General tab press unblock and save changes
Try installing again and this will fix the issue and install service.