To assist in the process of backing up and archiving .shared files an example VBScript file can be found in this article. Note:
Note: Running example code is done at your own risk and is not covered by QlikTech Support or Maintenance Agreements. Please backup any files prior to modifcation.
Shared files have become an important part of QlikView Server functionality, storing user information and objects, bookmarks and other collaboration objects. As with any file which is frequently accessed, they can become corrupt and therefore it is important to make backups regularly.
The attached VBScript file will take a copy of all the .shared files and create a zip file based on the date the script is run. Note that all source folders are set to default.
If you have mounted folders in QlikView Server, the script will need to be modified to zip all the required shared files located in the mounted folders.
*** VBScript ***Set objFS = CreateObject("Scripting.FileSystemObject")
- The account running the Directory Service must have read and write permissions to the source and destination folders
- 7-zip must be installed. This is freeware and can be downloaded from www.7-zip.org
- You will need to create a folder which will store the backup zip files. In the example the folder is C:\ProgramData\QlikTech\SharedBackups
'set the .shared file source folder
strFolder = "C:\ProgramData\QlikTech\Documents"
strBackupFolder = "C:\ProgramData\QlikTech\SharedBackups\"
'Set objFolder = objFS.GetFolder(strFolder)
mth = Month(current)
d = Day(current)
If Len(mth) <2 Then
If Len(d) < 2 Then
d = "0"&d
timestamp=yr & "-" & mth &"-"& d
'check the date backup folder exists, if not create it
if not objFS.FolderExists("C:\ProgramData\QlikTech\SharedBackups\" & timestamp) then
objFS.CreateFolder("C:\ProgramData\QlikTech\SharedBackups\" & timestamp)
'copy all the .shared files to the backup date folder
objFS.CopyFile strFolder & "\*.shared", "C:\ProgramData\QlikTech\SharedBackups\" & timestamp & "\", true
'zip the files here, using 7-zip - if you don't want to zip the files, delete the next three lines.
*** Zip ***
Dim objShell: Set objShell = CreateObject("WScript.Shell")
Command = """C:\Program Files\7-zip\7z.exe"" a " & "C:\ProgramData\QlikTech\SharedBackups\" & timestamp & ".zip " & "C:\ProgramData\QlikTech\SharedBackups\" & timestamp & "\*.shared"
RetVal = objShell.Run(Command,0,true)
'delete the backup folder - MAKE SURE THIS NEVER POINTS AT THE SOURCE OR LIVE FOLDERS!
objFS.DeleteFolder("C:\ProgramData\QlikTech\SharedBackups\" & timestamp)
'*** End Zip ***
set objFS = nothing'*** VBScript End ***
- Run the VBScript file to check the backup works and that a zip folder is created.
- Check the contents of the folder.
- Create a Publisher Supporting task and schedule it to run daily, during a time when the .shared files are unlikely to be in use. The files may not be accessible if in use by any other process during the backup