cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JimmiLee
Level 6

IS2009 and Services

I've got InstallShield 12 and am contemplating an upgrade, as I've got some issues with ServiceAddService and ServiceStartService in a Server 2003/2008 environment - they just won't start the service in question (though I can still add it) . . .

My code:
ServiceAddService("SchedulingServer", "CRM Extensions Scheduling Server", "", INSTALLDIR+"\Scheduling Server\\SchedulingServer.exe", TRUE, "");

and
ServiceStartService ( "SchedulingServer", "" );

My question is, would the above code work properly with IS2009 when installing on a server 2003 or 2008?
Labels (1)
0 Kudos
(8) Replies
DebbieL
Level 17

What project type are you using? If you're using a Basic MSI or InstallScript MSI, the typical method of adding and starting a service is to use the Component Wizard.
0 Kudos
JimmiLee
Level 6

Once I worked out that I need two components, one for installing the service and one to start it, as well as delete it on uninstalling, it all started working as intended 🙂
0 Kudos
VaibhavP
Level 3

JimmiLee wrote:
Once I worked out that I need two components, one for installing the service and one to start it, as well as delete it on uninstalling, it all started working as intended 🙂


Can you please give me the details steps to implement this?

Thanks,
Vaibhav Paralikar
0 Kudos
JimmiLee
Level 6

Ok, I will give you a more detailed guide in how to do this. Remember, this is a basic MSI project...

Installing the Service:
In the Installation Designer, pick Organizations->Components and in the main window right click components and pick Components Wizard. IS2009 will ask you if you want to associate the new component with a wizard now - I usually do this manually after creating the component, but it's up to you.
1. Once you continue the wizard, in the first window choose: "Let me select a type and define the component myself"...
2. In the second window, name the component and select "Install NT Service".
3. In this window, browse to your service executable - it's usually an exe file. Notice that this file will be copied to the root of your installation directory on the target machine. Click Add and the service will be added - then name the service.
4. In the fourth window give it a display name and possibly arguments. Furthermore choose whether it should run in its own process or with others - if you're unsure, choose it's own process!
5. In the fifth window you can set how the service should start up and if this works for you, there's no need to create the start service component, however, it didn't for me, so I had to - you can test and check first . . .
6. In the sixth window you can set load ordering and dependencies - it's rarely needed . . .
7. Then there's error control - I usually choose display a message box and then continue . . .
8. In this eight window, I always go with local account . . .

And you're done . . .

Starting the Service:
In the Installation Designer, pick Organizations->Components and in the main window right click components and pick Components Wizard. IS2009 will ask you if you want to associate the new component with a wizard now - I usually do this manually after creating the component, but it's up to you.
1. Once you continue the wizard, in the first window choose: "Let me select a type and define the component myself"...
2. In the second window, name the component and select "Control NT Service".
3. In the third window, choose the service.
4. In the fourth window, select "Start the Service" . . .
5. In the fifth, select stop and delete the service (OBS depends on your MSI).
6. In both installation and uninstallation I choose to wait for the service . . .

And you're done . . .

Hope this helps ...
0 Kudos
VaibhavP
Level 3

Thanks JimmiLee for your knowledgeable response!

I apologize for incomplete input from my site. I am using InstallScipt project. And I tried to install windows service using following function:

ServiceAddService("Enterprise","Enterprise"," Testing ","F:\\TestConsoleForService\\Release\\TestConsoleForService.exe",TRUE,"");

Where, TestConsoleForService.exe is a simple HELLO WORLD program in CPP. I did not implement any service specific in it.

Above function install service properly but it did not start, it failed to start with 1053 error. I have also tried to install this exe as a service manually using SC.exe, but I got same result.

Can you please help me in this aspect? Also let me know if we need to write service specific code in .exe program.
0 Kudos
JimmiLee
Level 6

As I wrote in the first post, I initially tried scripting it with ServiceAddService and ServiceStartService, but when testing on server 2003 and 2008 I couldn't get it to work, so to be honest I don't know how to solve this one with installscript . . .
Personally, I only use installscript when the Installation Designer fails me, so I'm not much of an Installscript Guy I'm afraid . . .

Do share the solution if you find it though and good luck . . .
0 Kudos
VaibhavP
Level 3

Yes sure JimmiLee.

Thanks for your support!

First, I need to find out if i can run any .exe (like simple HELLO WORLD CPP program) as a windows service or I need to implement special program (and create exe) to run it as exe.
0 Kudos
JimmiLee
Level 6

No worries - I like to help whenever I can, to give back the help I got from this commmunity . . .
0 Kudos