To check what ThinApp runtime version was used to build a single package you can use a simple command line argument.
MyThinAppPackage.exe -thinstall
While this is good enough to check one or two packages it isn’t very practical if you need to check a whole bunch of packages. Also the -thinstallversion command line parameter isn’t very script friendly either. But no worries the ThinApp SDK and PowerShell come to the rescue. The following script allows us to list the ThinApp runtime version of a specific file or all files in a folder (and subfolders):
Param
(
[Parameter(Mandatory=$true)]
[ValidateScript({ Test-Path $_ })]
[string]
$Path
)
$ThinApp = New-Object -ComObject ThinApp.Management
$files = Get-ChildItem $Path -Recurse | ForEach-Object {$_.Fullname}
ForEach ($file in $files)
{
Try
{
$ThinAppType = $ThinApp.GetThinAppType($file)
}
Catch
{
$ThinAppType = $null
}
If (($ThinAppType -lt 6) -and ($ThinAppType -gt 0))
{
$ThinAppPackage = $ThinApp.OpenPackage($file)
New-Object -TypeName PSObject -Property @{
Name = $ThinAppPackage.InventoryName
Version = $ThinAppPackage.ThinAppVersion
Path = $file
}
}
}
Row 1-7 is used to quiz the user for a path or a file. Then in row 9 the ThinApp com object is created and in row 10 a list of fully qualified file names (even of files in subfolders) based on the user provided path or file is created. In row 14 to 21 the script checks if it can get the ThinApp type of the current file and if not it catches the error. Within lines 23 – 30 if the current file is a valid (1-5) ThinApp package it reads out the InventoryName, file name and path and the ThinApp runtime version and creates a new PowerShell object for it.
In order to use this script you have to register the ThinApp SDK (to learn how to do it visit my “Getting started with ThinApp SDK and PowerShell” article) and then just execute the script in a PowerShell console and provide a folder or file. Here are some examples:
To check the version of a single file:
.\Get-ThinAppVersion.ps1 -Path 'Z:\ThinApp\Apps\Mozilla Firefox.exe'
To check the version of all files in the provided folder and subfolders:
.\Get-ThinAppVersion.ps1 -Path Z:\ThinApp\Apps
You can even check files and folders on a network share:
.\Get-ThinAppVersion.ps1 -Path \\server\thinapp
As the output is a fully functional PowerShell object you can do some cool stuff. For example you can create a CSV file listing all your ThinApp packages and the corresponding version or filter for a specific runtime version.
To export the results to a CSV use this command:
.\Get-ThinAppVersion.ps1 -Path Z:\ThinApp\Apps | Export-Csv -Path C:\temp\MyThinAppRuntimeVersions.txt
To only list ThinApp packages which are using a specific runtime version use this command:
.\Get-ThinAppVersion.ps1 -Path Z:\ThinApp\Apps | Where-Object {$_.Version -eq "4.7.0-556613"}
Download the script using the button below.
Download



Pingback: Cool Powershell version checker script for ThinApp SDK at That's my View