Search code examples
c#windows-serviceswindows-10virtual-machinevmware-workstation

How to install and start a windows service on a VMWare virtual machine for Windows 10


I have created a Windows Service in visual studios 2015, and want to use a virtual machine running windows 10 to test it. However, I am having trouble installing the service. I have enabled share file and shared the file containing my service executable, but when I try to use the command line to install it, it doesn't seem to work. I can't use the visual studios developer command prompt since it is not installed on my VM. Anyone know a way to do this?


Solution

  • You can do it without visual studio developer command prompt.

    Technically those are the steps:

    1. connect to your VM and open CMD.
    2. navigate to folder destination where the EXE of your service is found.
      for example: cd C:\Users\XXX\YYY\bin\Release
    3. install the service using that command (check your .net framework version in the VM): C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil yourservicename.exe

    4. probably you will need give permissions to the release (or whatever folder you have).
      the permissions is for LOCAL SERVICE and NETWORK SERVICE groups:
      right click on the release folder>>properties>>security tab>>Edit button >>Add button >>search for LOCAL SERVICE and NETWORK SERVICE using the Check Names button and finally allow those groups full control Permission.

    5. start the service via task manager>>services