Home > Blogs > VMware ThinApp Blog


Configuring the ThinApp SDK in place of ThinReg

Customers often ask if there’s a difference between using the ThinApp SDK vs. using THINREG.EXE and if there’s a benefit for using one over the other.

So let’s take a moment to explore this!

What is the ThinApp SDK?

The ThinApp Software Developer Kit is essentially the necessary bits to allow VMware customers and partners to programmatically access and work with ThinApp packaged applications.

What are the benefits for a customer?

Among the many ways in which a ThinApp package can be interacted with via another program, customers can use the ThinApp SDK to register and update ThinApp packages via simple tools such as scripts or other Object/API interfaces. This means, the ThinApp SDK can be used to assign or deploy ThinApp packaged applications to user, groups, desktop, and any other objects via a controlling program or script much in the same way the View Management Console can assign applications, but in a much more flexible manner.

Is there a benefit for using the ThinApp SDK over ThinReg?

Absolutely! The ThinApp SDK contains a wide variety of COM objects which can be utilized to do many things, and among those are the commands to register a ThinApp package. In fact, these same commands for ThinApp Packaged application registration are also in THINREG.EXE. The difference between using the two is, with THINREG.EXE, one must call the EXE each and every time. This means the following:

  1. Windows must shell out to the command line to call THINREG.EXE
  2. THINREG.EXE must load into memory.
  3. THINREG.EXE must then access the ThinApp package in question.
  4. THINREG.EXE must then act upon the ThinApp package in question.
  5. Once complete, Windows must unload THINREG.EXE from memory.

While the above are simplified steps for how THINREG.EXE is used and works, the ThinApp SDK works in a slightly different way in regards to a Windows desktop (native, virtual, or remote).

To use the ThinApp SDK….

  1. The administrator first extracts the ThinAppSDK.DLL file and copies it to the Windows desktop in question (i.e. the virtual desktop Gold Image).
  2. Then the administrator registers the ThinAppSDK.DLL file using REGSVR32.EXE. A typical command would be as follows:
  3. REGSVR32.EXE THINAPPSDK.DLL

  4. Once the ThinApp SDK has been registered into Windows the administrator simply access the ThinApp SDK objects loaded in memory whenever needed, referencing the ThinApp package desired to be acted upon.

Step 3 above can be accomplished via a login script assigned to users or group policies.

VB Script for Multiple ThinApp package Registration from ThinApp repository or file share:



AdminScriptEditor Script Conversion


' Recursive registration of ThinApp packages
' Author: Ge Van Geldorp
'         VMware Senior Developer, ThinApp
' 
' Usage: RecursiveReg.vbs <FolderName>
' 
' RecursiveReg will register all ThinApp entry points in FolderName and in any subfolders
' The registration will be per-user. Any entry points to which the user no longer has access
' (because of the PermittedGroups setting) and which are already registered will be
' automatically unregistered.
' You need to have ThinAppSDK.dll present and registered using regsvr32.

Option Explicit
Sub ProcessFolder(Folder, TAManagement)
Dim FolderName
FolderName = Folder.Path
' Process all files in this folder
   Dim File
For Each File In Folder.Files
' Construct the full path to the file
      Dim FileName
FileName = FolderName & "\" & File.Name
' We're only interested in .exe files
      If UCase(Right(FileName, 4)) = ".EXE" Then
' Check if it is a ThinApp entry point.
         ' ThinAppType 1 = Primary data container
         ' ThinAppType 2 = Shortcut executable
         Dim ThinAppType
ThinAppType = TAManagement.GetThinAppType(FileName)
If ThinAppType = 1 Or ThinAppType = 2 Then
' Ok, we have found a real ThinApp entrypoint. Register it,
            ' flag 1 means per user
            Dim Package
Set Package = TAManagement.OpenPackage(FileName)
Package.Register 1
End If
End If
Next
' Now do the sub folders
   Dim SubFolder
For Each SubFolder In Folder.SubFolders
ProcessFolder SubFolder, TAManagement
Next
End Sub
' Check arguments
If WScript.Arguments.Count <> 1 Then
WScript.Echo "Usage: RecursiveReg.vbs <FolderName>"
WScript.Quit(1)
End If
' Create ThinApp.Management object
Dim TAManagement
Set TAManagement = CreateObject("ThinApp.Management")
' Get a Folder object through the FileSystemObject
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim Folder
Set Folder = FSO.GetFolder(WScript.Arguments(0))
' Now start recursively processing the folder
ProcessFolder Folder, TAManagement
' All done
WScript.Quit(0)


ThinApp SDK RecursiveReg.txt

VB Script for ThinApp Single Package Registration/Unregistration:



AdminScriptEditor Script Conversion


'=================================================
' Set Environment Variables
'=================================================
Set TAManagement = CreateObject("ThinApp.Management")
Dim ThinAppType, Package
'=================================================
' Declare the ThinApp Package/File
'=================================================
FileName = "T:\Captures\AutoCAD2k5\bin\AutoCAD 2005.exe"
Set Package = TAManagement.OpenPackage(FileName)
'=================================================
' Register the ThinApp Package/File
'=================================================
RegisterPackage FileName, 9
MsgBox Package.InventoryName & " has been registered.", 4160, "ThinApp Registration Test"
'=================================================
' UnRegister the ThinApp Package/File
'=================================================
UnRegisterPackage FileName
MsgBox Package.InventoryName & " has been unregistered.", 4160, "ThinApp Unregistration Test"
'=================================================
' Functions
'=================================================
Function RegisterPackage(FileName, Flag)
Set Package = TAManagement.OpenPackage(FileName)
Package.Register Flag
' 1 - THINAPP_REGISTER_PERUSER - Indicates whether the shortcuts, file type associations, and the rest should be installed for the current user or for all users. Administrative access is required when installing for all users.
   ' 2 - THINAPP_REGISTER_NOARP - Do not register the package in the Add/Remove Programs control panel applet.
   ' 4 - THINAPP_REGISTER_KEEPUNAUTHORIZED - Do not unregister applications for which the user is no longer authorized.
   ' 8 - THINAPP_REGISTER_REREGISTER - Recreate all shortcuts and registry keys.
End Function
Function UnRegisterPackage(FileName)
Set Package = TAManagement.OpenPackage(FileName)
Package.UnRegister
End Function


ThinApp SDK – Package- Register-UnRegister.txt

VB Script for getting the ThinApp file type (Determine if EXE or MSI file is a ThinApp package):



AdminScriptEditor Script Conversion


'=================================================
' Set Environment Variables
'=================================================
Set TAManagement = CreateObject("ThinApp.Management")
Dim ThinAppType, Package
'=================================================
' Declare the ThinApp Package/File
'=================================================
GetThinAppType("T:\Captures\AutoCAD2k5\bin\AutoCAD 2005.exe")
'=================================================
' What type of file is it?
'=================================================
MsgBox "The ThinApp FileType is..." & Chr(13) & Chr(10) & "" & Chr(13) & Chr(10) & ThinAppType, 4160, "ThinApp Test"
'=================================================
' Functions
'=================================================
Function GetThinAppType(FileName)
ThinAppType = TAManagement.GetThinAppType(FileName)
Select Case ThinAppType
Case 1
ThinAppType = "Data Container"
Case 2
ThinAppType = "Entry Point"
Case 3
ThinAppType = "MSI With CAB"
Case 4
ThinAppType = "MSI Without CAB"
Case 5
ThinAppType = "Old MSI"
Case 0
ThinAppType = "Type Unknown"
End Select
End Function
'Function RegisterPackage(FileName, ThinAppType)
'   If ThinAppType = 1 Or ThinAppType = 2 Then
'      Set Package = TAManagement.OpenPackage(FileName)
'      Package.Register 1
'   End If
'End Function


ThinApp SDK – Management – GetThinAppType.txt

VB Script for Package-File Checking (Determine if a specific file resides within a ThinApp package and what the version of the file within the ThinApp package is):



AdminScriptEditor Script Conversion


'=================================================
' Set Environment Variables
'=================================================
Set TAManagement = CreateObject("ThinApp.Management")
Dim Package
'=================================================
' Declare the ThinApp Package/File and open
'=================================================
FileName = "T:\Captures\Flaming on Disc\bin\Flaming on Disc.exe"
Set Package = TAManagement.OpenPackage (FileName)
'=================================================
' Attach to the VFS and check for the file
'=================================================
Set VFS = Package.GetVFileSystemObject (0)
File = "%SystemRoot%\ThinApp IE Wrapper.kix"
FileCheck = Abs(FormatNumber(VFS.FileExists (File)))
If FileCheck = 1 Then
MsgBox "The file '" & File & "' was found inside the ThinApp Package " & FileName & "!", 4160, "File Found"
Else
MsgBox "The file '" & File & "' was NOT found inside the ThinApp Package " & FileName & "!", 4160, "File NOT Found"
End If


ThinApp SDK – Package- File Check.txt

Conclusion:

As one can see, this means the use of the ThinApp SDK can result in a much quicker registration process (or unregistration process) of ThinApp packages – especially during the user login. In turn, this allows for a much more fluid environment where dynamically assigned applications can be utilized to a greater extent, thereby allowing I.T. to provide a much more flexible and user friendly environment.

For more information see the following links:

  • VMware ThinApp SDK Communities Home page (and download)
  • Introduction to the ThinApp SDK video
  • ThinApp SDK Developers Blog
  • This entry was posted in Integration, Scripts, Tools and tagged , , on by .
    Dean Flaming

    About Dean Flaming

    Dean is currently an EUC Architect and member of the VMware End User Computing Enablement and Lighthouse Support teams, working to develop communications and IP around VMware End User Computing products and solutions as well as support many various Lighthouse accounts with their own EUC practices. Prior to this, from 2008 through 2012 Dean was one of VMware's End User Computing Specialists. Throughout his time at VMware, Dean has also written and published various articles, videos, and podcasts regarding VMware's EUC Solutions.