Sc tool offered by microsoft is execelent way to manually or via script delete or create services.
This shouldn’t be done if there is a installation procedure to do this but in cases when some software uninstallation is corrupted or service is removed but it needs to be present because of some dependencies it somes very handy. Of course, it is very usefull for some software developers/supporters as well.
This page (http://technet.microsoft.com/en-us/library/cc990289%28v=ws.10%29.aspx) offers nice insight on all parameters and offers example on how command is used but when i wanted to install my own service it was necessary to enable “Allow service to interact with desktop” option and i would keep getting error when i would use type= interact
So, to delete service (in case of corrupted uninstallation procedure which left useless service behind):
sc delete ServiceName
ServiceName in this case is marked on screenshot from windows service management console:
You can access this console by going Start->Run-> services.msc
To create service use:
sc create ServiceName binPath= “C:\Path\To\Exefile.exe” DisplayName= “Some fancy service name” type= own type= interact start= demand
In this case we created service from executable Exefile.exe which has parameter interact which will enable “Allow service to interact with desktop” option and it will be started on demand (manual start type, please use auto for automatic start).
Service will by default use LocalSystem account. Please note that it is important to make space between = and parameter value. In order to define interact type, it is necessary to specify type= own before that.