In this article I will explain how to install Windows Service build in C# or VB.Net on a Remote Server Machine using <>InstallUtil.exe file.
In order to install the Windows Service on a Remote Server Machine, first task is to locate the InstallUtil.exe file.
 
 
Installing the .Net Framework
The very first thing you need to do is download and install the necessary .Net Framework on your system.
 
 
Locating the InstallUtil.exe file
Once the .Net Framework is installed, you can look for the InstallUtil.exe file for installing the Windows Service on the remote server machine.
If your windows is installed in C drive you could find the InstallUtil.exe at the following locations.
32 BIT
C:\Windows\Microsoft.NET\Framework
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe
 
64 BIT
C:\Windows\Microsoft.NET\Framework64
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe
Now based on whether your Windows Service is developed as 32 BIT or 64 BIT application and the .Net Framework version it is built, you need to get into the respective .Net Framework Folder.
In my case the Windows Service is 32 BIT application and built using .Net Framework 4, I am looking for the InstallUtil.exe in the following location C:\Windows\Microsoft.NET\Framework\v4.0.30319\
 
 
Installing the Windows Service using InstallUtil.exe using InstallUtil.exe from Command Prompt (Line)
Once the Windows Service is build you need to find the EXE file in the Debug folder of the Project.
Note: Once the Windows Service is ready for deployment, it is recommended to make use of the Release version of the EXE file instead of the Debug version.
To find the EXE, simply right click Project and select Open Folder in Windows Explorer. Now navigate to Bin => Debug folder and look for the EXE file with name same as that of the project.
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe
 
Now copy and build the path in a Notepad (Text) file.
Note: I would recommend to build the command in a Notepad and save it somewhere so that you can use it multiple times.
 
InstallUtil Syntax
InstallUtil /i <Path of Windows Service EXE file>
 
Example:
InstallUtil /i C:\Users\Mudassar\Projects\WindowsService\bin\Debug\WindowsService.exe
Now you need to open Windows Command Prompt by typing cmd command in the Run window.
In the command prompt window, copy the InstallUtil command from Notepad and right click in the Command Prompt and click Paste and then press Enter key.
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe
Now the Installer will ask for Logon permissions to run the Windows Service and hence you will need to add Windows Username and Password of user who has appropriate permission.
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe
 
Note: Username must include Domain Name or the Computer name.
 
After successful installation you will see the following message.
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe
You can find the Windows Service in the Services window. In order to open Services window in the Run Command type, services.msc and hit enter.
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe
 
Uninstalling the Windows Service using InstallUtil.exe using InstallUtil.exe from Command Prompt (Line)
The syntax for uninstalling a Windows Service is very similar to the installation syntax.
InstallUtil Syntax
InstallUtil /u <Path of Windows Service EXE file>
Example:
InstallUtil /u C:\Users\Mudassar\Projects\WindowsService\bin\Debug\WindowsService.exe
After successful uninstallation you will see the following message.
Install or Uninstall Windows Service on a Remote Server Machine using InstallUtil.exe