How to start a windows service

Got a problem you cannot solve? Try here.
Post Reply
prasanth.nair
Posts: 15
Joined: Mon Feb 21, 2011 1:09 pm

How to start a windows service

Post by prasanth.nair »

Hi,

I am trying to start a windows service. Here is the msi code attached. I am using a batch file (installservice.bat) to install the service and then trying to start the service using Run Program. Any help is appreciated.

if Variable RUNAPP Equals TRUE
if Variable REMOVE Equals FALSE
if Variable SUCCESS Equals COMPLETE
Run Program $TARGETDIR$\_ClientAgents\BatchFile\DeleteFolders.bat (WAIT)
Run Program $TARGETDIR$\_ClientAgents\BatchFile\Install Service.bat (WAIT)
Run Program $TARGETDIR$\_ClientAgents\BatchFile\CreateFolders.bat (WAIT)
Set Variable SRVSTART to FALSE
Run Program $WINSYSDIR$\\net.exe start Atlas Store Daemon (WAIT, get result into variable SRVSTART)
if Variable SRVSTART Equals TRUE
Run Program $TARGETDIR$\_ClientAgents\Atlas.windowsAgent.exe
else
MessageBox: ATLAS STORE DAEMON, Atlas Store Daemon Service not started. Please start the service manually.
end
Comment: TO-DO: Insert command that starts your application here
end
end




Thanks
Prasanth Nair
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: How to start a windows service

Post by giaviv »

Dear Prasanth,

Please consider the Control Service command (F1 anywhere in the InstallAware IDE and search for Control Service).
We do not recommend calling 3rd party executables because their stability and existence is never promised on target machines.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
prasanth.nair
Posts: 15
Joined: Mon Feb 21, 2011 1:09 pm

Re: How to start a windows service

Post by prasanth.nair »

Thanks. Can I start already installed service using Control Service ?

Here is the code that I tried.

Control Service Atlas Store Daemon: start on install [wait for completion]


Looks like the above code is not working. Do i need to change something else to start the service.

Thanks
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: How to start a windows service

Post by giaviv »

It should work. Are you sure that your service is properly installed and working?
Does it run when you go to cmd and type "sc start <YOUR_SERVICE_NAME>"?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
prasanth.nair
Posts: 15
Joined: Mon Feb 21, 2011 1:09 pm

Re: How to start a windows service

Post by prasanth.nair »

Yes. I can start the service using sc start command. I tried a different service using the same code. No luck. :?
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: How to start a windows service

Post by giaviv »

Could you please send your service to support at installaware.com?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
prasanth.nair
Posts: 15
Joined: Mon Feb 21, 2011 1:09 pm

Re: How to start a windows service

Post by prasanth.nair »

I tried the same code in a different machine. It is working good. Thanks.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: How to start a windows service

Post by giaviv »

Great. I am glad it was figured out.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
jbutler
Posts: 2
Joined: Thu Nov 10, 2011 7:24 pm

Re: How to start a windows service

Post by jbutler »

I'm having the same issue. Simply try to start SQL Server Service using this approach:
Control Service _SQLServerService: start on install [wait for completion]
Service does not start.
If I run the sc start MSSQLSERVER in a cmd window (run as administrator) the service starts running.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: How to start a windows service

Post by giaviv »

Could you please also try the same code on a different machine?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply