Ways to performing an efficient and automated updates of your software products
Simplifying the update process easily and painlessly is one of the most challenging tasks for every programmer. In addition, this task is harder and again because of tightening access rights and new restrictions inside Windows infrastructure. They are meant in a goog manner (as we see, the figure of potential threats is increasing steadily) but can be a significant bottleneck for delivering updates of our apps.
As an author of about twenty projects for Windows, I was also looking for something simple which will help me to deploy updates of my apps and will be acceptable either for common users without the necessity of escalating their credentials, or for system administrators who will consider my solution safe and adequate.
Regarding this, I searched every nook and cranny across Internet and found many solutions. All of them offered a wide bunch of user-friendly features, ways how to enrich the process of the update, options for customizing a visual part of the setup/update process and many more. But none of them was able to perform the update without escalating the user credentials, i.e. without providing rights for executing installation of apps. Except one.
The winner of my imaginary competition is called Software Update Wizard and it's the product of PowerProgrammer company seating in The United Kingdom. Let's talk about undeniable benefits of this solution:
- fundamentally, almost without any modification of your code
- only necessity is to add one line to your code (for calling update service with concerning script file)
- update service itself runs under local administrator account - no escalations of the existing user privileges are needed
- huge options for customizing the update dialogs - texts, colors, appearance
- an option for working with (password protected) ZIP files
- various methods for checking version of updated file
- particular log system for watching and controlling the update process or identifying bugs
- one and the same scenario for all your projects (in unlimited version)
- very reasonable pricing
- using the update service for the information purposes as well (online or attendance courses invitations, delivering news etc.
How it works? First of all, you have to provide a WUWINSTALLER.EXE installation utility that is a part of Software Update Wizard and can be distributed freely. In my case (using InstallShield Express), I added WUWINSTALLER.EXE to the list of processes that must be executed during installation of our systems. This step assures that WUWINSTALLER.EXE installs the appropriate update service and starts it under Local System account. You'll see the running service in Services window:
Secondly, you have to provide a license file, WEBUPDATESVC4.LIC, for a proper working of updates. This file will be delivered after placing an order of Software Update Wizard and is universal for all your projects (in case you're a holder of unlimited license). License file must be put into your app's directory.
Main implementation of the update process in your code is extremely simple. In Delphi, for instance, call the ExecuteFile method with three parameters - the first one is the name of main executable file WUWSTUB.EXE, the next one is a filename of your update script (see the example below) and the last one switches the update execution into hidden mode (SW_HIDE).
Executefile('wuwstub.exe','https://www.yamaco.cz/userfiles/file/updates/edx/edx716.txt', '', SW_HIDE);
Regarding main script for execution, it's a normal text file with commands. Every command consists of a keyword and value. List of keywords is described in online help in a very detailed way, with many examples. The particular keywords belong to certain categories, like keywords affecting handling files, working with ZIP, killing selected processes if they are running, customizing update dialogs and messages etc. As an example, here is a real script for updating one of our project:
[1]
Zipfile=https://www.yamaco.cz/userfiles/file/updates/edx/edx71601.zip
KillProcess=edx32cs.exe
Message=*body scroll="no" style="font-family: Verdana; font-size: 80%; color: Black;"*Greetings, new update 7.16.0.1 of Gamekeeping is available. Do you wish to download and install it?*/body*
Importance=Optional
Title=Automatic updates
Subtitle=YAMACO Software
Icon=https://www.yamaco.cz/userfiles/file/updates/mnp.ico
ShowSystemTray=Show|Software Update Wizard|Downloading and installing in progress|Update
ExecBefore=Powershell Add-MpPreference -ControlledFolderAccessAllowedApplications "C:\Windows\SysWOW64\WebUpdateSvc4.exe"
FinalMessage=The update has been fisnished. You can run the app again.
I mentioned that Software Update Wizard could be used for information and/or advertisement purposes too. In this case simply provide the appropriate information (text, PDF file) that you intend to deliver and modify the script:
Executefile('wuwstub.exe','https://www.yamaco.cz/userfiles/file/bulletin/edx/bulletin.txt', '', SW_HIDE);
*CampaignOriginator=YAMACO Software
URL=https://www.yamaco.cz/userfiles/file/bulletin/edx/edx20230202.pdf
ShowFrom=2023/02/03
ShowTo=2023/02/20
MaxShows=2
MaxPerDay=1
DayInterval=10
AskBefore=Now
AskBeforePrompt=There is a new information for users available.Would you like to display it??
Title=User information
Subtitle=YAMACO Software
As is shown in the example, you have a broad control over the delivery process - when and how often, repetition, prompt etc.
This short excursion shows a very comfortable way how to deliver updates of your Windows apps smoothly and easily. We have been using the Software Update Wizard for more that 15 years and found it extremely flexible not only at workstations but in the server environment as well. We appreciate wide and professional technical support and comprehensive documentation.
More information about Software Update Wizard, trial downloads and documentation are available at the vendor's page.
About the Author
Ing. Karel Janecek, MBA, MSc.torry.net