/build/static/layout/Breadcrumb_cap_w.png

Launch Services at the end of an installation process

Hello !

Today, I'm questioning you about Services.
I'm packaging an application and I have to install a Service used by this application.

I noticed that MSI gives some tools to start, stop, launch services, which are associated with components. The problem is that I have to schedule the installation as follow :

1*/ Copy all the files to the target
2*/ Launch an .exe installed with this package (the setup of my application. I must launch it before the service because the service uses some informations given in the setup)
3*/Launch the service.
4*/End the installation process.


Do you have any idea of how I could do that ?

Thanks !

0 Comments   [ + ] Show comments

Answers (24)

Posted by: MSIPackager 18 years ago
3rd Degree Black Belt
0
You can only start services etc if they are installed as part of you MSI..

Sounds like you are best off using "net start servicename" command as a custom action at the end of your install.

Regards,
Rob.
Posted by: babric 18 years ago
Senior Purple Belt
0
Do you mean that I should INSTALL the service during the install, and START it at the end ?

[8|] That should run as I would like to, but I didn't think about it... need to sleep :-)

Thanks !
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
ORIGINAL: MSIPackager

You can only start services etc if they are installed as part of you MSI..

Sounds like you are best off using "net start servicename" command as a custom action at the end of your install.

Regards,
Rob.


Since when did "Windows Installer" stop controlling services that it didn't install??

But "yes" Babric, you should install and control your service using MSI actions if you can.
Posted by: babric 18 years ago
Senior Purple Belt
0
Since when did "Windows Installer" stop controlling services that it didn't install??

Could Mister MSIPackager say something wrong ? ooooh nooo ! The world collapses... [:D]

But "yes" Babric, you should install and control your service using MSI actions if you can.

It appears I can't. I have to launch an application I install with the same package, and then, launch the service. But why not Install the service using MSI, and then launch it with some batch commands ?
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
That's what I'm suggesting...

You could "recapture" or "repackage" your setup into MSI format, and use the "InstallServices" and "StartServices" actions to install and start the service.

Alternatively, run your setup silently (if you can) from a deferred execution custom action - after the "InstallFiles" action but before the "StartServices" action. Try a type 18 custom action (+1024=1042). Then you can start the service using the "StartServices" action.
Posted by: babric 18 years ago
Senior Purple Belt
0
That's what I'm suggesting...

You could "recapture" or "repackage" your setup into MSI format, and use the "InstallServices" and "StartServices" actions to install and start the service.


Ok, I understand now :-). The incomprehension was that I'm using InstallShield and the Services options are associated with the components. So I didn't realize that I could separate these 2 actions. In the future, I'll try to always read the Windows Installer help (and not only Installshield help) before asking questions...
[&:]
Posted by: babric 18 years ago
Senior Purple Belt
0
Alternatively, run your setup silently (if you can) from a deferred execution custom action - after the "InstallFiles" action but before the "StartServices" action. Try a type 18 custom action (+1024=1042). Then you can start the service using the "StartServices" action.

I will run my setup after InstallFinalize, but not silently, because the user have to write some informations. I'll use a Synchronous CA, but could you explain me the difference between a deferred CA and an Immediate CA ?

For example, what is the difference between using a deferred CA, and schedule an immediate CA after InstallFinalize ?


EDIT : I tried to understand the MSDN about it, but don't unerstand really, someone could give me an example ?
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
For example, what is the difference between using a deferred CA, and schedule an immediate CA after InstallFinalize ?

Missing the boat!

In other words... "timing".

Try using numbered message boxes to see what I mean. Place one after the "InstallFinalize" action in the (immediate), then place several messages at various points during the deferred sequence - including one after the "InstallFiles" action and one before the "StartServices" action.

If you place one just before "InstallFiles" too, you'll clearly see that the files are not copied until this point.
Posted by: MSIPackager 18 years ago
3rd Degree Black Belt
0
Since when did "Windows Installer" stop controlling services that it didn't install??

It didn't - I thought the service was being created by the .exe setup and was suggesting net start as a way of starting it at the end of the install.

Sorry if I wasn't crystal clear Mr Gates [&:] just trying to help...
Posted by: babric 18 years ago
Senior Purple Belt
0
Try using numbered message boxes to see what I mean. Place one after the "InstallFinalize" action in the (immediate), then place several messages at various points during the deferred sequence - including one after the "InstallFiles" action and one before the "StartServices" action.

I tried, and I think I have understood something very important about the installation process. The fact that the installer "scripts" and then execute this script was not assimilated. Hope that it is now :-)
Posted by: babric 18 years ago
Senior Purple Belt
0
Hello,

WiseUser, I tried to follow the way you told me (deferred CA), but I don't succeed in.
This is my Sequence table

http://img354.imageshack.us/img354/8648/execsequence3zi.gif

I have to launch, after the installation of the service but before it starts, an application called "ESServer.cpl".
This app is installed with my product in the SystemFolder. I can see it during the install.

I tried differents CA but I can't launch my program :

I tried to launch it as an exe (CA 18 (+ 1024) ? don't remember) (error 1721)
I tried to launch it from a directory (as I do for the .bat -> CA 34 + ( 1024) ) (error 1721)
I tried to write a VBscript :


Dim oWSH
Set oWSH= CreateObject("WScript.Shell")
oWSH.Run Property("SystemFolder") & "\ESServer.cpl", 1, True
set oWSH = nothing


(error 1720, I think that there is a brackets problem, but I can't resolve it)

and now, I don't now what I could try...

Has anybody any idea ?
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
A ".cpl" file is not an executable file - "Control.exe" is.
Posted by: babric 18 years ago
Senior Purple Belt
0
maybe, but when I double click on it, there is a window that the user has to populate.
That's what I called an executable (even if it's not an exe) :-)
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
What I'm telling you is that you need to run "control.exe" with the ".cpl" file as a command line parameter.[:D]
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
Try a type 34 or a type 50 CA.

Add 1024 (user) or 3072 (system) for deferred mode.

Add 64 to ignore exit code if necessary.

Type 34 CA example:

Action:LaunchESServerCPL
Type:3170
Source:SystemFolder
Target:Control.exe ESServer.cpl

Type= 34 + 3072 + 64 = 3170
Posted by: babric 18 years ago
Senior Purple Belt
0
What I'm telling you is that you need to run "control.exe" with the ".cpl" file as a command line parameter.

[8|][&:] I didn't notice that you were talking about THE control.exe :-) And what is funny is that I just tried it because a colleague told me to try that 5 mins ago :-)

So, yes, now it works, but the problem is that the install continues and don't wait for the user having populated the window... Think that is because control.exe end immediately ?

I'll try type 34 & 50 too.

thanks !

EDIT : Works fine with CA 34 following your example.
I looked at the Task Manager during the installation, and "control.exe" end up after 5 or 10 sec... and the installation p'rocess continues :-/ Argh. Not good for me... Another problem, another solution ! [;)]
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
Tu ne m'écoutes donc pas??[:D]

Je t'ai dit "+64" ("Synchronous").

Edit: Seems to be a problem displaying French characters!
Posted by: babric 18 years ago
Senior Purple Belt
0
Tssssssss don't be so nervous :-)
Synchronous doesn't solve the problem, as I explained it. The problem is that it is synchronized on "Control.exe" and not on "ESServer.cpl"...

Non mais !
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
OK - point taken.[:D]

Use a VBScript then.
Posted by: babric 18 years ago
Senior Purple Belt
0
Same problem...
VbScript works as MSI... or do you have a special solution ?
Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
0
Yes, I think you need to use "Rundll32.exe".

Something like this...

Set oWsh= CreateObject("WScript.Shell")
oWsh.Run "rundll32.exe shell32.dll,Control_RunDLL ESServer.cpl", 1, True
Set oWsh = Nothing

Et voilà![:D]

You could still use a type 34 actually:

Action:LaunchESServerCPL
Type:3106
Source:SystemFolder
Target:rundll32.exe shell32.dll,Control_RunDLL ESServer.cpl

Should work fine!
Posted by: babric 18 years ago
Senior Purple Belt
0
Hey ! Same idea ! (Almost...)

Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run("rundll32 shell32.dll,Control_RunDLL esserver.cpl,@0,1", 0, True)
Set objShell = Nothing


:-) I'll try this tomorrow, my test computer is down now :-(

A big thank for your help !
Posted by: babric 18 years ago
Senior Purple Belt
0
That works fine :-)

Thanks again !
Posted by: Justatech 18 years ago
Yellow Belt
0
Hello,

My question is somewhat similar. The only thing is, the services would only start after rebooting the computer. Is there a way for the services to start immediately after the installation w/o restarting the computer?

Thanks
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ