0

I am a total newbie to InstallShield. I am trying to create a installer for my project in which I have to install Wildfly 11 as service. Wildfly 11 has a file service.bat which suits my need very well. There are some issues I am facing for which I need help.

1) When I try to create a service in InstallShield by selecting System Configuration->Service it says to add files related to service in a component and make the file which I want to run as a key file. The issue here is as my key file which I want to run is .bat file, the service is not recognizing it as it need an .exe file to run.

2) Some how i managed to create a custom action which runs my .bat file to start the service and it works fine. Now is there a way in InstallShield which can change the service Startup Type to automatic?

Even though I resolved my first issue I am still mentioning it here because I want to know is this the idea way of doing or am I naive enough of not knowing the ideal way.

For your kind information I am using InstallShiled 2014 Premier version and I am working with BasicMSI project type.

Thanks in advance for help.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
k.lo
  • 403
  • 2
  • 5
  • 13

2 Answers2

0

I'm not familiar with running a bat file as a service. If you're trying to set this up in an MSI the proper way then you're in the right place under System Configuration->Services. Your bat file should be installed via a component. When you create the Component be sure to set the bat file as your Key Name. Once you've configured that you should be able to set the Start Type.

I would not recommend doing this with a custom action since you have to take into account upgrades and uninstall. My guess is that you're not considering this yet.

If you want to continue down the path of doing this in a custom action you should use the command line sc.exe command or its corresponding API in whatever language you're writing your custom action with. Add the code for changing the Start Type within your custom action.

Doc
  • 698
  • 3
  • 16
  • I tried the same you said david. My service gets installed but when I try to start the service I get error 1053. I created one component with dynamic link files for the entire Wildfly server folder and excluded the .bat file I want to make as key file. Created one more component and added the .bat file and made it key file. Then created a service to with the component which had .bat file. But i got error when i tried to start the service. What am I missing here. Any help would be great. – k.lo Apr 26 '18 at 07:10
  • Similarly how can I pass a parameter to this bat while the bat runs any way to do this as well. – k.lo Apr 26 '18 at 07:14
  • I would investigate further why your service is failing. The "Best Practice" way to install a service is using the Service* tables in MSI. If you type 'sc /?' from a command line it should give you a list of options. I'm really not familiar with running a bat file as a service. That just seems odd to me. I would seriously stay away from using dynamic file linkage in InstallShield. If you google for this you'll find that it has serious problems with upgrading and key files. You will save yourself a lot of time and headache if you just take the time and create a component for each file. – Doc Apr 26 '18 at 13:40
0

Service Installation: Batch files are not run as services (normally), but in some cases they are used to install service files in EXE format. Typically this is done by developers during development, or for manual installation of services on a limited amount of computers. Some people also use scheduled tasks to run batch files such as these on system startup. Not an approach I would recommend.

For larger scale distributions you use a proper package for deployment. MSI is one such format. When you use MSI you are not supposed to install services with batch files. Rather you should register and configure the service via the appropriate MSI tables to take advantage of the built-in service configuration capabilities. Essentially you author the ServiceInstall and InstallControl tables to install and control the service in question respectively.

Using this built-in approach is much more reliable than using a custom action. Some context on why custom actions should only be used when needed: Why is it a good idea to limit the use of custom actions in my WiX / MSI setups?

Use the appropriate MSI features for service configuration and control and you will have a much esier time upgrading and maintaining your package.


Installshield Procedure:

Service installation batch files are often intimidating to look at, but when you analyze them they might not actually do much. In some cases huge chunks of them relate to parsing a command line and deal with error conditions.

It is usually possible to extract the information required from these scripts - and it tends to center around finding if there are any login credentials for the service, and to replicate the install of all files the batch file copies in place inside the MSI - so the MSI entirely replaces the BAT file as deployment solution.

  • Open your batch file in an editor and locate the EXE file it installs.
  • This EXE file will be the real Windows service file. There could be several versions - such as 32-bit and 64-bit flavors.
  • Add the appropriate EXE file to your MSI file / Installshield project.
  • Add any support files the service needs to run. You can analyze this with dependency walkers and process monitors if problems are seen.
  • I don't have a recent version of Installshield available to test with. In older versions you opened the component view and located the component with the service in it. You opened it and went to Advanced Settings and configured the Install NT Services and the Control NT Services entries.
  • You can set several settings for the service, including startup type (automatic, for example) and login credentials (if any are required).
  • You mention that your Installshield version has the view System Configuration => Service. Use this view after you have added the service EXE file via the Files or Component views.
  • I normally set a service to start and stop during install and to stop and delete on uninstall. If the service requires credentials to run you need to extract that information from the BAT file and add as properties to the service control items.
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164