cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
yogesh12
Level 3

IS 2008 - Service to stop and remove on un-installation

Hi,

Using IS 2008 - Basic MSI Project.

Have written a function
=======================================
function MyFunction(hMSI)
begin
if MAINTENANCE then
ServiceStopService( "bigVault Helper Service" );
ServiceRemoveService( "bigVault Helper Service" );
endif;
end;
=======================================

The "Install Exec Sequence" for the function is "After StopServices".
The problem is that the service is not getting stoped and hence not getting removed.

I have tried using the
GetExtendedErrInfo ( svScriptFile, nvLineNumber, nvError )
to get the error and the output that i got was

Error in the file Service.rul line no. 396 and the error code return was 0.





The IS help for the function ("ServiceStopService ") that i have called does not state anything on support for OS Vista

=======================================
ServiceStopService
InstallShield 2008 InstallScript Language Reference

The ServiceStopService function stops the service that is specified by szServiceName.

The ServiceStopService function is supported only for Windows NT, Windows 2000, and Windows XP systems; the function will fail on Windows 95, Windows 98, and Windows Me systems.
=======================================
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

Is it an option to use the Control NT Service advanced settings in a component?

(If not, is your action scheduled for deferred execution?)
0 Kudos
yogesh12
Level 3

Yes we have used the Control NT Service advanced settings in a component. We have two events for the service: SerStart and SerStop.

SerStart properties:
Install Start: YES
Install Stop: YES
Service Argument: -install

SerStop properties:
Uninstall Stop: YES
Uninstall Delete: YES
Service Argument: -remove


Regarding the action: In-Script execution: Immediate Execution
Execution scheduling: Always execute.
0 Kudos
RobertDickau
Flexera Alumni

As a rule, actions that make system changes should be scheduled for deferred execution, and not immediate execution.

Another thing to verify is that ServiceStopService (and the other InstallScript service functions) wants the internal service name, and not the display name...
0 Kudos
yogesh12
Level 3

Thank you sir for your valuable information. Its working.
0 Kudos