When you’re using ThinApp to package your software packages you are bound to end up with a huge repository after some time. Of course you have documented each ThinApp package you made, but sometimes you will need to produce a quick-and-dirty report. Then it’s handy to fire up a PowerShell script, instead of reading through all the packaging documentation.
With the help of the ThinApp SDK it’s quite easy to produce such a report.
The script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
$RepositoryRoot = "\\MyFileServer\MyShare\ThinApp" $thinMgmt = New-Object -ComObject ThinApp.Management Get-ChildItem -Path $RepositoryRoot -Recurse -Include "*.exe","*.dat" | ` where {$thinMgmt.GetThinAppType($_.FullName) -eq 1} | %{ $package = $thinMgmt.OpenPackage($_.FullName) $options = $package.GetOptions() New-Object PSObject -Property @{ FileName = $_.Name Directory = $_.Directory.FullName PackageName = $package.InventoryName PermittedGroups = &{ $SIDs = $options | where {$_.Name -eq "PermittedGroupSIDs"} $permitted = if($SIDs){ $SIDs.Value.Split(';') | %{ if($_ -ne ""){ ([adsi]"LDAP://<SID=$_>").cn } } } if($permitted){[string]::Join(',',$permitted)} } ThinAppVersion = ($options | where {$_.Name -eq "CapturedUsingVersion"}).Value RequiredApps = &{ $required = ($options | where {$_.Name -eq "RequiredAppLinks"}).Value if($required){$required.Replace(';',',')} } SandboxName = ($options | where {$_.Name -eq "SandboxName"}).Value SandboxPath = ($options | where {$_.Name -eq "SandboxPath"}).Value } } | Export-Csv "C:\ThinApp-Report.csv" -NoTypeInformation -UseCulture |
Annotations
Line 1: Define the root directory of your ThinApp packages repository.
Line 3: Open the interface to the ThinApp SDK. See also my Using the ThinApp SDK from PowerShell post.
Line 5: Retrieve, recursively, all the EXE and DAT files from the repository. The reason for this is that the main data container can be in both types of files.
Line 6: Only look at the main data containers.
Line 7: Open the main data container
Line 8: Retrieve all the options that are defined for the package.
Line 10-32: Extract the required information for the report from the Options data.
Line 19: Translate the SID into a human-readable name 🙂
Line 33: Export the report to a CSV file
Sample run
The use of the script is quite straightforward, just enter the path to the root of your ThinApp repository in line 1 of the script.
Run the script and it will produce a CSV that looks something like this. For simplicity’s sake I used abstract names for the application names 🙂
Note that the PermittedGroups columns contains the actual AD Group names instead of the SIDs.
The report also shows the required apps that are defined for an application.
Andreas
Hello!
I just used this script and its awesome.
But I have following question:
I want to know the sandbox name for alot of subfolders.
But I only get result from 1, all the thinapps is separated in differend folders under the repository.
How can I edit the script to get the result from all subfolders??
Thank you!
George
LucD,
Is there a way to get a report from View on which users have which thinapps installed? Our users are assigned thinapps from view.
Thanks
LucD
Hi George, as a matter of fact I was recently looking into such a function. Let me get back to you.
Chris
Nice!