cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vlusardi
Level 2

Need to start only the services that were not omitted in the custom setup dialog.

I have a checkbox in the last dialog of my basic MSI install (SetupCompleteSuccess dialog) that, when checked, starts the services via a C# custom action. Currently, the CA starts all services. But, if the user disabled some of the services in the custom install dialog, i need to be able to start only those services that remain. I'm relatively new to IS, and can't figure out how I can access the list of services (or features) that the user has chosen to keep. IS must keep a collection of these for its own purposes when the StartServices CA is run, so I'm guessing it's a matter of finding this. Or maybe i could just call StartServices in my own CA and it would be that simple...?? Ha...

Hoping this is possible. Thanks in advance for your input.
Labels (1)
0 Kudos
(3) Replies
chad_petersen
Level 9

Remember, when you are running your installer on a system - InstallShield itself is no longer involved. It is only the authoring tool. It is not technically used during the runtime of the MSI at all. Otherwise, everyone that installed your installer would need InstallShield first. I hope that makes sense. It is sort of a philosophical discussion.

Feature states are tracked by the operating system and the MSI engine.

Everything a person needs to know is here.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa368012(v=vs.85).aspx

In a nutshell the Condition for the ServiceControl will be "&MyFeature=3" where you replace "MyFeature" with the name of your feature.

I hope that is somewhat helpful.

WiX seems to do the right thing automatically, if you read the Start attribute description here.

http://wixtoolset.org/documentation/manual/v3/xsd/wix/servicecontrol.html


Chad
0 Kudos
vlusardi
Level 2

i appreciate the input, but I'm not clear on how it answers my question. I want to run a c# custom action from a button press, using a checkbox state as the condition for whether to execute the action or not. The action is in the form of a C# Managed Code CA, and it would return a collection from the ServicesInstall table so that I could determine which services to run based on the StartType field. If you or anyone else has suggestions for how this can be done, I'd appreciate the input.

I've done plenty of searching online and I've seen where the (DTF) Deployment Tools Foundation is used by calling OpenDatabase() and other functions using a reference to the Microsoft.Deployment.WindowsInstaller assembly. The issue I have is that this assembly appears to be available only with a WIX Toolset install, and i don't want to rely on another deployment tool outside of InstallShield to complete the task. I also see that InstallScript has functions to do this as well, so I will investigate that option further. Would really rather develop in C# if at all possible.

Thanks in advance for any suggestions.
0 Kudos
chad_petersen
Level 9

Ah, I see. You don't want the services to start, or not, until the very end based off of a checkbox that launches your C# action. That's certainly a way to do it. I always let MSI start the Services that are installed and not start those that are not installed and it takes care of it for me, but like I say that is using the built-in abilities and it happens before InstallFinalize.

Best of luck!

Chad
0 Kudos