Wix update - How can I restart my service but no other apps that are using my dll? - windows

I have created an installer and I put out the update every now and then. FYI, my program has two parts: service application and dll. Some of other client applications use my dll and my service application runs constantly.
Because some of client applications use my dll, if I run the update, restart manager restart those client apps but I would like to make sure that they do not restart so I disabled restart manager by setting MSIRESTARTMANAGERCONTROL to be 'Disable' in my wix script.
So this prevents other client apps from restarting and that is great. But the side effect of it is that my service application does not restart either after the update procedure.
So basically my question is that I would like to find a way to prevent other client apps from restarting but I want to make sure that my service does restart after the update.
What would you recommend? Any advice will be appreciated.

You need to postprocess the MSI package emitted by your setup build. You will need to add entries to the ServiceControl table so that Windows Installer will stop the service when your component is installed and then start it up again after the new DLL is installed. You'll also need to ensure that the StopServices and StartService actions are scheduled in the InstallExecuteSequence table.
You'll need to use the wirunsql.vbs tool to run the relevant INSERT queries to add the necessary records.

Related

Alternative to manage Apps Installtion/Updates via Endpoint Manager

I am currently using Endpoint Manager to install Apps on employees machines.
However, from time to time apps need to be updated. With MSI apps it quite strightforward. The issue is with EXE apps, is there is a manual process that requires to go and create a package.
I was wondering if there is a better option to manage it? So I can trigger app installation without preparing it manually. Maybe with another tool that integrate with Endpoint manager and will save us some time.

How to make a program run at startup (as admin) with WiX on Windows 10

Can someone tell me how to properly install this program to run with admin privileges at startup on Windows 10 using WiX?
All the help I've seen via Google has been old ones saying to use the Startup folder. Now, although the Startup folder still seems to work, I don't think it's the preferred way to do it anymore.
I also need think the need to run as admin adds a wrinkle in the process.
I can see few ways to do it:
Set registry values using WIX:
in this case you should add your app install path to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run (x86) or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run (x64). Problem is to get windows version. I guess it's possible to do by WIX (using few RegistryKey elements with condition) but I haven't tried.
Use custom action to set registry values: the same as previous, but using C#. Also in this case it will be easy to determine windows version and add your app to the right key.
Using custom actions and Task Scheduler. For example you can use this library to add task to run after startup.
Run cmd using WIX to set up Task Scheduler (or via custom actions). The same as previous but without any libs.
A program requesting or requiring admin is a function of the EXE not WiX. The EXE should be manifested to request elevation.
MSFT has said it is not a best practice to have things in startup request admin. It's a horrible user experience.
The better approach is to do what you said you do in your comment. Have a component running as a service that the non-priv UI can communicate with.

Inno Setup Automatic Setup update [duplicate]

I have an executable application setup.exe for Windows that I realized with Launch4j/Inno Setup based on Java.
I often frequently release new versions and bug fixes.
I would like to know if there is a mechanism to install updates automatically?
Inno Setup does not have any built-in mechanism for implementing automatic updates.
You need to implement that yourself:
Make your application check for new versions (against your application webpage?). E.g. on startup (on a background thread?)
If the application detects a new version, make it download an installer to a temporary location.
Make the application execute the downloaded installer. You can make the installer run in silent mode (/silent switch). The application should close itself, to unlock any files it is using, to allow files update.
This approach will need the update installer to prompt for Administrator privileges. If you need the update to proceed completely seamlessly, you will have to implement a service. For that, see Deploying application with .NET framework without admin privileges.

MSI: An Application is running during silent update

I have an application that was installed as MSI package, I have next version of application that I plan to install in silent mode by special program.
When application is running I catch an issue: not all components of application installed
immediately, some of them will be really ready only after reboot. And I get unstable application.
I can check - is application running and wait until it closed, but I can't check the situation when user click on shortcut during silent installation.
How I can avoid this? Can I lock application during installation?
I suggest implementing Restart Manager support. Vista or later will attempt to shut down your application via the Restart Manager, you can decide how to handle it within your application (prompt user, autosave, something else, etc).
You won't catch the situation where the user starts the application during update, but it will handle multi-user sessions more gracefully than your custom code will.

How do I schedule an install to happen on the next reboot using MSI?

We have an MSI installer (created using Wix) which is setup to be able to perform upgrades. Our clients are using it to upgrade our application on multiple machines at once using an SMS package running msiexec in silent mode.
The problem with this is that some of their users will still be running our application at the time the installer is run. We don't want to kick these users off, and running the install while they are using the app invariably breaks things.
Our ideal solution would be for the install to be scheduled to happen the next time the machine boots up.
This is a fairly hefty list of requirements, but does anyone know how I could achieve this or where I might look next?
You could add a value to the registry under HKLM\software\microsoft\windows\currentversion\RunOnce and it will run the next time a user logs on.
Windows Installer automatically detects files in use. Also, during a silent installation it handles them automatically:
files which are not in use are overwritten
files in use are scheduled for update after a reboot
As you can see, this is somewhat problematic because some files are updated and some file are not.
A good solution is to set REBOOTPROMPT property to "S". This way the target machine is automatically rebooted after install.
Unfortunately MSI packages cannot detect running processes, stop the install and schedule it at the next reboot. This could be done only with a custom EXE bootstrapper.

Resources