Saturday, June 13, 2009

Install window service without using installutil

Article is about to install window service without using InstallUtil utility.
Windows XP or Later has command line utility called sc . (This utility talks with service controller and with services from command line).
SC is a window base utility. AS explain in article http://dotnetstep.blogspot.com/2009/06/install-windowservice-using-installutil.html sc does not required ProjectInstaller.

1. Start service using sc
          sc start ServiceName

2. Stop serivce
         sc stop ServiceName

3. Delete window service
        sc delete servicename
        Note : During delete call if service is in running state then service is delete when nexttime service is stop or PC restart.

4. Create window service
       sc create ServiceName binpath= “c:\windowservice1\windowservice1.exe”

       Apart from above many option available . For that just go to command prompt and type sc create /?

  For example configure service running account.

sc create servicename binpath= “c:\windowservice1\windowservice1.exe” obj= administrator password= pass

Hope this article will help you .

Please give your comment or idea about this.

In above all case Service ServiceName ( Mark as blue) , don’t use display name.

 image

2 comments:

Anonymous said...

Just a quick Note:

When creating the service there is a space between the = and " ie.

computer called \\remotecomputer:
sc \\remotecomputer create newservice binpath= "c:\nt\system32\newserv.exe"

took me a while to figure out whit it would not work.

Anonymous said...

Yeah strange syntax with the space after the equal, thanks for mentioning it.

Here's my line that work:
sc create SVC binpath= "c:\svc.exe"