Home > Blogs > VMware ThinApp Blog


Deletion of a Sandbox during ThinApp MSI Installs / Uninstalls

 Lakshmana Prakash
ThinApp Packaging Consultant
ThinApp Community: Lakshman
lprakash@vmware.com
 
 
Problem:
 
During initial launch of the ThinApp EXE, a new sandbox is created, which holds the runtime 
modification of the application. After an uninstall of the ThinApp software the sandbox is not 
deleted. 



When installing ThinApp again and launching the software, the EXE will use the existing sandbox, 
as ThinApp does not create new sandbox. This may result in: 

  • Undesired behavior of the application when interacting with the old settings of sandbox
  • Cannot revert the ThinApp back to its original state

Limitation:
 
At present, the Package.ini configuration settings are to remove the sandbox on exit. Deleting 
the sandbox during ThinApp MSI uninstall process is currently not supported.
Solution:
 
The deletion of the sandbox can be accomplished by modifying the ThinApp MSI along with the 
help of vbscript. 
 
1.  Edit the template.msi (under %programfiles%\VMware\VMware ThinApp) using any
MSI editor tools, preferably Orca (freeware from Microsoft).
 
2.  Write a vbscript (DeleteSB.vbs) to delete the sandbox folder from %appdata%\Thinstall.
A simple VBscript code is below which removes the sandbox „WildEdit‟. 
 
Const SandboxFolder = " WildEdit "
Dim strComputer, oWMI, oWSH, oFSO, AppdataFolder, ThinstallFolder, FolderToDelete
 
strComputer = "."
Set oWMI    = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set oWSH    = CreateObject("WScript.Shell")
Set oFSO    = CreateObject("Scripting.FileSystemObject")
AppdataFolder = oWSH.ExpandEnvironmentStrings("%appdata%")
Set ThinstallFolder = oFSO.GetFolder(AppdataFolder& "\Thinstall")
FolderToDelete = ThinstallFolder & "\" & SandboxFolder
 
if oFSO.FolderExists(FolderToDelete) then
oFSO.DeleteFolder(FolderToDelete)
End if

3.  Add a new row in Binary table with the below details: 
 
2-chart

This will add the vbscript to the MSI as a binary data. 
 
 2-table

 
4.  Add a new row in CustomAction table with the below details:  
 
2-chart 2

 4-table

 
 
5.  Add a new row in InstallExecuteSequence table with the below details:  
 
5-table

 5-chart

 
6.  Run the build.bat. The generated ThinApp MSI is now capable of deleting the sandbox
during the uninstall process. 
 
 
 Conclusion: 

  • To delete the sandbox only during installation process, add the condition “Not
    Installed”
  • To delete the sandbox during both installation and the uninstall process, leave the
    condition  as blank