Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Suppressing service installation


5 replies to this topic

mstone

mstone
  • Members
  • 20 posts

Posted 26 August 2004 - 17:10

I'm trying to prevent some NT services installation with a VBScript custom action (type 38) that removes the corresponding rows from the ServiceInstall table. The CA is scheduled in the InstallExecuteSequence before the InstallServices action. It executes with no error but the InstallServices action still installs all the NT services, even those supposedly removed by the CA.

For testing purposes I even tried to change the CA to remove _all_ the records:

Set oView = Database.OpenView( "delete from ServiceInstall" )
oView.Execute
oView.Close

but InstallServices doesn't seem to pay attention: it still installs all the services initially listed in the table.

I also tried to turn the custom action into deferred (type 1024+38) but then it fails with 1720.

Any ideas?

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 01 September 2004 - 04:16

CAnt you just add a condition to the component that the service is installed by?? i dont think you can delete the table rows once the msi has loaded.

mstone

mstone
  • Members
  • 20 posts

Posted 01 September 2004 - 06:46

The thing is the component itself must _always_ be installed but to register or not register the corresponding service depends on a run-time condition (namely, whether this component was previously installed or not). Thus, static conditionalizing of the componet won't work.
There is no doubt it's possible to modify the tables. E.g. I successfully do it in the UI sequence. Of course, the changes are not persistent.

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 01 September 2004 - 07:21

Hmm ok then, I really think the install should have been setup so that the component only has the service, and you simply could have put a condition on the component.

Try movning the service back to the beginning of the InstallExecuteSequence and see if that works. If no, then I am a bit stumped, but if it does work, then keep moving it up the sequence until it stops working.
You might need to run it before InstallInitialize, but im not %100 sure on that...


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 01 September 2004 - 09:51

I am fairly sure your approach won't work no matter what you do, but there is a slight chance that it could work if you run the action before InstallInitialize.

As you know the windows installer transaction runs between InstallInitialize and InstallFinalize, and anything added here will be "run twice" in a way (not always run twice, but evaluated twice). First the actions are read while the installation script is being written (immediate mode), then when MSI hits InstallFinalize it starts running the installation script actions (deferred mode) starting at InstallInitialize. Once you get into deferred mode the database is read only for sure, and it is quite possible that the InstallFinalize action will roll back any temporary records added to your installation database in immediate mode (but this I am not sure of).

In conclusion: I think you need to either register this service using Installscript or a VBscript so you have more power to control and check the current state, or redesign the installation in some other fashion.
Regards
-Stein Åsmul

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 02 September 2004 - 08:26

It's possible to modify the tables in the Execute sequence, but do it before InstallInitialize. I did exactly this with the ShortCut table, worked terrific.
My experience learnt to be very careful about one thing: when the install is run again (eg. repair, uninstall, ...) make sure you modify the tables exactly like the last time setup was run.