Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not see my service under services after installing with Topshelf

I am pretty sure the answer is so simple but here it is;

I'm using TopShelf to install my service and I can succesfully install and run it from command line as

MyExecutable.Daemon install MyExecutable.Daemon start

This is fine but it has to be amongst the Services and it wasn't so I tried;

sc create "MyExecutable.Daemon" binPath= "C:\'Program Files (x86)'\MyExecutable.Daemon.exe" DisplayName= "MyExecutable.Daemon" start= auto

but got

Set-Content : A positional parameter cannot be found that accepts argument 'binpath='.
At line:1 char:1
+ sc create MyExecutable.Daemon binpath= "C:\'Program Files (x86)'\...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Set-Content], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetContentCommand

So I'm stuck here. What am I missing here?

like image 758
Bilsay Avatar asked Sep 19 '13 11:09

Bilsay


1 Answers

sc in powershell is the alias for set-Content cmdlet use sc.exe instead.

Try this (not tested)

sc.exe create "MyExecutable.Daemon" binPath="C:\'Program Files (x86)'\MyExecutable.Daemon.exe" DisplayName="MyExecutable.Daemon" start=auto
like image 108
CB. Avatar answered Nov 15 '22 23:11

CB.