I have an MSI installer that installs a Service and by default it is stopped. The user can manually turn it on or leave it stopped. I also have a Patch for the MSI.
Problem: When installing the Patch, the service is stopped. I would like the Patch to leave the Service ON if it was ON, and OFF if it was OFF. How can i achieve this funcionality?
So in the end i used two Custom Actions. One that saves the status of the services prior to installing the Patch. I used properties like
MYSERVICE_STATUSsetting them to “0” if the services areSTOPPEDand “1” if they areRUNNING.After the Patch installation finshes, i launch another Custom Action that checks these properties and the final state of each Service. If
MYSERVICE_STATUS == 1and the Service is nowSTOPPEDthem, i restart it.