Script to install console service app?

Hello all,

My windows installer tool can install a console app, but cannot install it as a windows service.

Has anyone used sc create as part of a batch file to install a service app, as a service? Or, can anyone recommend a better way to do this? I have been using Deploymaster for years with great results. But it cannot meet this requirement without writing an external .dll, which I do not know how…

Thanks all,
Tim

Hi Tim,

Have a look at this. It’s a service app that checks if it’s running as a service and if not creates the service & starts it then quits.

There is no checking for UAC issues.

HTH

Wayne

Hi Wayne,
Will have a look - THANK YOU!
Tim

Hi Wayne,

Is this to be inserted as “part of” an existing app? Or next to it as a “run once” kind of install tool?
In the source, this string “sc query IAmAService” appears. Is this code to be replaced with the name of the app to check/install? Sorry for the late questions on this. I had gotten diverted to another element of the project and am now JUST getting back to this!

Thank you Wayne!
Tim

Aaron Ballman who used to work for REAL Software wrote an app called ServiceManager. It’s six or seven years old, but might nonetheless be of interest.

The source no longer seems to be on his website, but you might check it out here to see if it will help you out.

I have run an RS web app. as a service ( for testing ) under Win.XP using a command like…

sc create RSWebSvc type= own start= auto binpath= c:\\Path\\To\\Exe\\WebApp.exe

Hi Tim

You would include this in your existing app. It checks each time it’s run.

Yes you’ll need to change the string IAmAService to your service name.

Wayne

Thank you Wayne,
Tim

http://msdn.microsoft.com/en-us/library/sd8zc8ha(v=vs.110).aspx

CommandLine:
installutil yourproject.exe

Installutil.exe
http://originaldll.com/file/installutil.exe/31502.html