cancel
Showing results for 
Search instead for 
Did you mean: 
bgardels
Flexera beginner

Installscript Project - Install Service

I'm creating a new Installscript project that fails to install an EXE as a service.  I have a component created for it and the file properly gets copied, but it fails to register it as a service.  I assume that InstallShield would use InstallUtil from the .NET folder to register, but it never works.  I have verified that the proper paths to .NET are in the Options dialog.  I have also verified that I can also install this EXE as a service by manually using InstallUtil through a command prompt.  I keep thinking there should be something, within the IS interface, to identify this as a service, but don't see anything.  What's funny, is that I have access to another InstallScript project (someone else created) which does properly install this EXE as a service.  But, the only difference I can find between these two projects, regarding installing this EXE, is the version of INstallshield.  How are services installed for a InstallScript type project?

0 Kudos
3 Replies
banna_k
Frequent contributor

Re: Installscript Project - Install Service

In an InstallScript project, you would need to use the Objects view to add the NT Service object to your project.

If it is working in the previous version, you can copy merge module to your new version if the NT Service object not available in the latest version you are building.

Refer below links for more info:

https://community.flexera.com/t5/InstallShield-Forum/I-can-not-find-NT-Services-in-quot-Installshiel...

https://installshield.subscribenet.com/control/inst/AnonymousDownload?dkey=5423951

0 Kudos
bgardels
Flexera beginner

Re: Installscript Project - Install Service

Thanks for the reply.

There are no merge modules in this old project. The service, that it's installing, is a .NET assembly (EXE file) that is simply setup as a component. I don't even see any use of ServiceAddService() in the InstallScripts. What other methods are there for installing a service and why is not clear on how this old project is registering this EXE as a service?

For my new InstallScript project, I'm currently examining the use of ServiceAddService() function to install this EXE as a service. Is this a viable solution?
0 Kudos
Flexera Jenifer
Flexera

Re: Installscript Project - Install Service

Hi,

I have sample script which can provide additional error information.With that it could help you to sort out

 

function OnFunction()

STRING svUserName1, SERACTPASSWORD, szName, svResult, svValue, szPath;
NUMBER nResult, nResult2;
POINTER pSERACCOUNT, pSERACTPASSWORD;

begin

svUserName1="<USERNAME>";
SERACTPASSWORD="<PASSWORD>";

// Define Service Logon Specifics
pSERACCOUNT = &svUserName1;
pSERACTPASSWORD = &SERACTPASSWORD;
ServiceInitParams ();
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.lpServiceStartName = pSERACCOUNT;
SERVICE_IS_PARAMS.lpPassword = pSERACTPASSWORD;

// Install Application Server service
szPath = TARGETDIR ^ "<service.exe>";
nResult = ServiceAddService ("Application Service", "Application Service", "Application Server Service", szPath, TRUE, "" );
if (nResult < ISERR_SUCCESS) then
GetExtendedErrInfo ( szName, nResult, nResult2 );
NumToStr ( svResult, nResult );
NumToStr ( svValue, nResult2 );
MessageBox ("Cannot install Application Server service.\n" +
"\n Script: " + szName +
"\n Line: " + svResult +
"\n Error#: " + svValue +
"\n Error: " + FormatMessage (nResult2), SEVERE);
endif;

end;

 

Hope it helps,

Thanks,

Jenifer

0 Kudos