Due to some instability with the product a few times, where an app was in a irreversible state and no code/data code be returned - I created a small backup solution in PowerShell.
As always with software, backup is the key:
- Full machine backup and/or file/folder backup over the network is great, but not always possible.
- An app can be manually exported from the QMC from time to time, or automated with QRS API. However this requires exported certificates and similar.
- If an app is not possible to open due to data errors, it can be opened "without data" - but this doesn't always work in case of binary file issues.
- A last resort to somewhat restore app content is to read the app script logfiles at C:\ProgramData\Qlik\Sense\Log\Script, remove the timestamps and script row number with Alt+mouse in Notepad++ in order to extract the script. This is not a viable solution, did not extract front-end and removed script comments.
In version 2.x these crashes caused frustration with the product, so we now copy all apps that has been edited/entered the past x days (usually 30) to be backuped to a local/network folder. This is done through a PowerShell script scheduled in Windows Task Scheduler.
This script reads logfiles from Qlik Sense Server and does not interact with the API, repository or similar. This is considered an extra solution when those usual ways of communicating is out of reach.
- Reads logfiles instead of API communication, up to x days old.
- Can copy files wherever PowerShell can, including UNC paths
- Choose between an hourly, daily or hourly+daily loop to continuously copy development work - and automatically remove old files.
- Choose between copying just accessed and/or modified (development) apps.
- Creates folders automatically if not in place.
- Includes user generated objects.
- Excludes default apps, License Monitor and Operations Monitor. As of 2017-12-22 they do.
Feel free to use!
- This script is designed for development servers, it is not an excuse for ordinary backup of apps.
- It listens to what apps you have access to
- If nobody has used an app within x days backwards, it will not be copied.
- This task should be run by the same service account as the Qlik services to ensure access to C:\ProgramData\Qlik\Sense\
- Do not forget to fill out the variables in this script.
- Don't forget either to fill out the template for Windows Task Scheduler, depending on how often you want the scrip to run.
- Verified for Qlik Sense Enterprise 2.2.4, 3.1.1 and September 2017
Version 1.05, 2017-12-21
- Updated to different archived log folder, now that we need to have a common root folder
- Included the monitoring apps instead of excluding them. They saved me on a data failure.
- Now tested with Qlik Sense Enterprise September 2017
- Note that these versions of the app includes user generated objects, see here: https://community.qlik.com/thread/231776
Version 1.04, 2017-04-07
- A few typos fixed
- Folders are removed first, then the new ones copied. This ensures not a bunch of old removed apps stays around.
Version 1.02, 2016-11-10
- Verified for Qlik Sense Enterprise 2.2.4 and 3.1.1