disable service during a patch install
Posted 27 June 2014 - 10:14
I need help.
I would like to create a custom action which disable the services when i launch a quick patch.
Would you have any ideas to help me ?
Posted 27 June 2014 - 17:18
Using the proper ServiceInstall and ServiceControl tables you will be able to make this happen the built-in Windows Installer way. Setting the option in ServiceControl will enable you to stop and start the service during the install.
Edited by Glytzhkof, 29 June 2014 - 13:02.
Posted 29 June 2014 - 09:00
I imagine the OP wants to stop the service so that its files can be patched. The 2 tables don't allow conditions to be set: your only choices are what to do when installing or uninstalling.
There are a quadzillion script examples out there which will control services. Not all are brilliantly written (almost none that I came across had any form of error-control, for example) but they'll serve as a base from which to build a robust solution. All you need then do is add the script as a CA and condition it appropriately.
Edited by VBScab, 02 July 2014 - 09:08.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.
Posted 29 June 2014 - 13:04
I am certain you can use the ServiceControl table as long as you use a regular patch, not sure about a QuickPatch. A regular patch uses the same InstallExecuteSequence as a patch install.
Posted 30 June 2014 - 08:12
Thanks guys, that will help me a lot.
I will probably use a sample batch script through a custom action to disable the services.
I mark it as "solved"
Posted 30 June 2014 - 10:25
Well in fact noi it doesnt work and i don't understand why :
I'm going to explain how is my custom action :
Working Directory : SHORTCUT = It is where is my .bat
File Name & Command line : "[SystemFolder]cmd.exe" /c "[INSTALLDIR]Exe\Fr\Shortcuts\StopServices.bat"
Return processing : Asynchronous (no wait for completion)
In Script Exex : Immediate execution
Execution scheduling Always execute
Run patch during uninstal Yes
Install UI Sequence After PatchWelcom
Do you see mistakes in this config ?
Edited by julienpec, 30 June 2014 - 10:27.
Posted 30 June 2014 - 10:46
i forgot to say that this CA was included in the quick patch
Posted 30 June 2014 - 14:26 Best Answer
Okay, problem solved,
Take notes : Custom actions don't work with Quick Patch
Thank you guys for your help
Posted 30 June 2014 - 20:14
What did you do to solve the problem? Custom actions do work with regular minor upgrade patches, though they tend to be problematic if not conditioned right.
The QuickPatch project type is a special Installshield concept with limited capabilities dating back to the pre-MSI 2.0 era. I believe it is a special type of minor upgrade wrapped as a patch with a few Installshield twists thrown in. I think you are correct that this project type does not offer custom actions. See this comparison table for an overview of the differences between a regular patch and a QuickPatch project.
- I would not use the QuickPatch project type at all. It seems a rather obsolete feature. I may be wrong since I have never used it, but Installshield developers have told me it pre-dates MSI 2.0 as a concept.
- It is most definitely possible to control your service via the standard ServiceControl table during a regular patch installation. I have done so many times in countless setups. This works flawlessly and reliably when done right.
- A regular patch is just a delivery mechanism for functioning minor or major upgrades delivered as a patch instead of full size MSI files. All MSI features are supported, you must just test that the patch actually operates as expected.
- I have used patching professionally several times, but I try to avoid using it too much due to its complexity and limited cost-benefit ratio. It is a lot of testing, for very little gain. For a small fix to a large product it is a very good match. It is not the best writing - just jotted down experience, but maybe you can check this post from me with some patching advice.
Edited by Glytzhkof, 30 June 2014 - 20:49.
Posted 01 July 2014 - 08:28
Yeah indeed, i've concluded that CA didn't work for Quick Patch.
I was realy insterested in using Quick Patch because it is realy instinctive and easy to use. But an other problem of Quick Patch is, if you change your main project, your quickpatchs won't take into account these modifications. It implies that you need to create other quickpatchs if you've change your project, and that is a huge constraint !
That's why i've decided to use patch from Patch Design and Major Upgrade. I won't use any minor upgrade because you can't uninstall it.
I'm going to read your post with patching advice, it looks very interesting !
I have to propose to my boss a way to patch/upgrade their product including the "versionning" and which king of upgrade/patch it is better to use.
Thank you very much for your answer, this forum is realy amazing ! It helps me a lot and i'll try in return to give my opinion on various issues.
Ps : Sorry for my english
Posted 01 July 2014 - 09:29
Like Stein said, you shouldn't need a custom action to stop a service. But in general and for others who may look at this thread later, here are a few points regarding your custom action settings in general:
- Setting "Run during patch uninstall" will execute the custom action ONLY when a patch is removed (to revert the application back to the un-patched state). It does not run when the patch is installed and it doesn't run when the whole application is uninstalled, only when the patch is uninstalled. So your custom action was never called.
- Your custom action probably needs admin rights, therefore it should be scheduled to run "deferred in system context" and placed in the InstallExecute sequence between InstallInitialize and InstallFinalize.
- When Return Processing is set to "Asynchronous (no wait for completion)" Windows Installer will trigger your custom action and then continue with the installation without waiting for your custom action to finish. So the two will now run parallel at the same time, which can result in race conditions and the results may vary for each run of your setup.
Posted 01 July 2014 - 10:47
Thanks a lot Stefan !
You have answered things i asked myself yesterday.
Concerning the non necessary of a CA to disable the services, i know that the services are actualy disabled while the patches are installing, but i had some bugs certainly because i forgot to put a Dongle .
At the moment, it's mainly to make me improve in CA.
Posted 01 July 2014 - 13:07
Sounds like a complex setup. I too have used custom actions to deal with services, but I prefer not to. And in your case the QuickPatch seems to not support it. Be careful with major upgrade patches. They are not recommended by Installshield themselves.
On another note: I frequently use read-only custom actions to inspect the system in complex ways and to set properties necessary for the installation. I find these custom actions very good since they need no rollback feature and have been referred to by co-workers as much easier to understand and update than other MSI constructs. This latter issue is obviously a big concern if you work in a team. However, I do not like read-write custom actions at all if there is a similar built-in MSI feature to do the same. Besides the obvious complexity and debugging, you also have the issue of rollback support and a lot of extra QA.
If I understand your case correctly I would use a read-only custom action to inspect the system to determine if all prerequisites for installation are fulfilled. Then I would return an interactive error message and push the same message into the MSI log file.
Here is the best advice you will ever get on deployment issues: if available, get your QA team to understand the setup basics and its different installation features and have them test these for your for every release. Don't go crazy, just the basic ways: install, uninstall, patch install / uninstall, uninstall and variations on these. And then you write a more detailed test plan for yourself and hand it out for every public release and test all setup features.
Edited by Glytzhkof, 02 July 2014 - 10:57.
Posted 01 July 2014 - 16:50
you've understood well my case.
The product that i have to package is used by a lot of platforms and currently, the current manage of the several versions is a mess because every platforms decides which patch.upgrade they want to install.
You will understand that each platform has a different version of product than the other. Manage this is hard !
That's why i would like to find a process to limit this problem.
Promote major upgrade seems to be interesting for me because you don't need any prerequisites. The problem is, you can't go back like patches if you realize that your update doesnt work.
The ideal for me would be to create patches which are able to include prerequisites (like previous patches missing). To be more clear, if your client decides to install the patch 2.0.2 and that the 2.0.1 is missing, that would be more than great that this patch 2.0.2 installs the 2.0.1.
Concerning your idea of read-only CA, it seems interesting, i note that, thank you.
A the moment i'm "fighting" with the Patch Design because i have an understanding error 6434 (compression problem >_<) but i'll fix this quickly i guess