Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there an easy way to make a windows service?

Question: Is there a way to make a program run with out logging in that doesn't involve the long painful task of creating a windows service, or is there an easy way to make a simple service?


Info: I'm working on a little project for college which is a simple distributed processing program. I'm going to harness the computers on campus that are currently sitting completely idle and make my own little super computer. but to do this I need the client running on my target machines.

Through a little mucking around on the internet I find that what I need is a service, I also find that this isn't something quite as simple as making a scheduled task or dropping a .bat file into the start up folder.

I don't need a lot. if I could just get it to call "python cClient.py" i'm completely set. Is there an easy way to do this? like adding a key in the registry some where? or do I have to go through the whole song and dance ritual that microsoft has made for setting up a service?

like image 461
Narcolapser Avatar asked Aug 16 '11 04:08

Narcolapser


People also ask

Can we create Windows Service?

Let's create a Windows Service in C# using Visual Studio. Open Visual Studio, go to File > New and select Project. Now select a new project from the Dialog box and select “Window Service” and click on the OK button.


1 Answers

If you already have the executable you wish to run as a service you can use "sc" built into the OS already. Microsoft details the procedure here: http://support.microsoft.com/kb/251192

example: sc create "My Service" c:\temp\executable.exe

C:\Users\somebody>sc create

DESCRIPTION:      Creates a service entry in the registry and Service Database. USAGE: sc <server> create [service name] [binPath= ] <option1> <option2>...

OPTIONS: NOTE: The option name includes the equal sign.
      A space is required between the equal sign and the value.   type= <own|share|interact|kernel|filesys|rec>
       (default = own)   start= <boot|system|auto|demand|disabled|delayed-auto>
       (default = demand)   error= <normal|severe|critical|ignore>
       (default = normal)   binPath= <BinaryPathName>   group= <LoadOrderGroup>   tag= <yes|no>   depend= <Dependencies(separated by / (forward slash))>   obj= <AccountName|ObjectName>        (default = LocalSystem)   DisplayName= <display name>   password= <password>
like image 180
Wandering Penguin Avatar answered Oct 03 '22 05:10

Wandering Penguin