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 !
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)
Please log in to answer
Posted by:
MSIPackager
19 years ago
Posted by:
babric
19 years ago
Posted by:
WiseUser
19 years ago
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
19 years ago
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
19 years ago
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.
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
19 years ago
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
19 years ago
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
19 years ago
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
19 years ago
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
19 years ago
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
19 years ago
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 :
(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 ?
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:
babric
19 years ago
Posted by:
WiseUser
19 years ago
Posted by:
WiseUser
19 years ago
Posted by:
babric
19 years ago
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
19 years ago
Posted by:
babric
19 years ago
Posted by:
babric
19 years ago
Posted by:
WiseUser
19 years ago
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!
Something like this...
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:
Type:3106
Source:SystemFolder
Target:rundll32.exe shell32.dll,Control_RunDLL ESServer.cpl
Should work fine!
Posted by:
babric
19 years ago
Posted by:
Justatech
19 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.