I defined an installer limited to basic user interface. I would like to backup one file from app directory on uninstall. I created a VBS and attached it as EXE with working directory in Install Execution Stage before "Remove Resources". The VBS is a part of installation, is not a temporary file. The script works standalone but not on uninstall of app. What am I doing wrong?
I noticed you are using Advanced Installer 9.4 which has predefined support for this functionality. Instead of a .VBS custom action, why don't you try the more reliable and easy to use Persistence Operation from your file's context menu -> Properties -> Operations tab?
If you need the backup at uninstall time, you can set the condition to:
"Launch EXE with working directory" has a completely different intended functionality as described in the user guide. Is there a certain reason you're using this approach?
With an installed file resource, any custom action must be set after Install Execution Stage -> Add Resources action group with a "Deferred" execution option. This ensures the installer will have access to the installed file.
I have already tried to use "Launch installed file". But I get an error that the file (the VBS) doesn't exist. At a execution time after Install Execution Stage -> Add Resources the App including VBS and the file to backup was already deleted from the disk by uninstall process.
The execution of my VBS must be done before the removal is performed.
no problem, here is the description step by step:
- my new created MSI installs Firefox Portable Browser
- on first start of Firefox the data folder with Firefox profile will be created. This folder ist not a part of installation.
- within this folder is the bookmark file with user's bookmarks created and will be filled with bookmarks
- in case of problems with the application Firefox will the package be uninstalled including profile folder and of course bookmark file
- before this step is done I want to backup this file to save user's bookmarks and copy it back after re-install of the app
- I wrote a VBScript for this and attached it into MSI. The script should be executed on uninstall but before the entire app folder will be deleted
In this case, there's no need to use custom behavior because Advanced Installer has predefined functionality to accomplish this.
Here's what you can try:
- add a search from the Search page which returns the path location of the folder which contains the user specific files
- create a property based folder using the search name public property
- set a preserve operation for that folder (context menu -> Properties -> Operations tab) with the following condition:
But is there maybe a problem with my VBScript? I get a script error message in uninstall log:
...
...
MSI (s) (40:50) [10:49:38:719]: Doing action: Lesezeichen_sichern.vbs
Aktion beendet um 10:49:38: ProcessComponents. Rückgabewert 1.
MSI (s) (40:04) [10:49:38:734]: Entering MsiProvideComponentFromDescriptor. Descriptor: T%i&7oT-C?kaTW(0fqX8Toolbox>M5KDYSUnf(HA*L[xeX)y, PathBuf: EFF340, pcchPathBuf: EFF33C, pcchArgsOffset: EFF294
MSI (s) (40:04) [10:49:38:734]: MsiProvideComponentFromDescriptor called for component {997FA962-E067-11D1-9396-00A0C90F27F9}: returning harcoded oleaut32.dll value
MSI (s) (40:04) [10:49:38:734]: MsiProvideComponentFromDescriptor is returning: 0
MSI (s) (40:04) [10:49:38:734]: Entering MsiProvideComponentFromDescriptor. Descriptor: T%i&7oT-C?kaTW(0fqX8Toolbox>M5KDYSUnf(HA*L[xeX)y, PathBuf: EFF2EC, pcchPathBuf: EFF2E8, pcchArgsOffset: EFF240
MSI (s) (40:04) [10:49:38:734]: MsiProvideComponentFromDescriptor called for component {997FA962-E067-11D1-9396-00A0C90F27F9}: returning harcoded oleaut32.dll value
MSI (s) (40:04) [10:49:38:734]: MsiProvideComponentFromDescriptor is returning: 0
Aktion gestartet um 10:49:38: Lesezeichen_sichern.vbs.
MSI (s) (40:04) [10:50:53:986]: Produkt: Mozilla Firefox ESR Portable -- Fehler 1720. Es liegt ein dieses Windows Installer-Paket betreffendes Problem vor. Ein für den Abschluss der Installation erforderliches Skript konnte nicht ausgeführt werden. Wenden Sie sich an das Supportpersonal oder den Hersteller des Pakets. Benutzerdefinierte Aktion: Lesezeichen_sichern.vbs Skriptfehler -2146827864, Laufzeitfehler in Microsoft VBScript: Objekt erforderlich: 'WScript' Zeile7, Spalte 1,
...
...
This is line 7 in my script:
...
set objShell = WScript.CreateObject("WScript.Shell")
...
your suggestion will not help me. In case of uninstall the folder with this file will be deleted. I will copy this file to another location on the disk before removal. After re-install this file can be copied back to the profile folder.
However, this is irrelevant because it involves customizing the install sequence in order to have access to the resources at the proper time.
We recommend using the predefined approach. Custom actions have the purpose to accomplish unaccounted for scenarios, but the developer must have extensive knowledge of the standard actions and how Windows Installer works.