$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
Background
Customer uses Citrix XenApp 5 with ThinApp, RES Workspace Manager and RES Workspace Extender.
An application integration strategy is defined, the picture below displays the strategy and preferred order:
Question
Customer wanted to know the type (1..7) for all applications currently defined in RES Workspace Manager.
I decided to export all the Applications from RES WM as Building Blocks. This results in a folder with XML files. I decided to parse the XML files with a PowerShell script.
The scripts display a progress bar while running, indicating the current Building Block and percentage complete:
When the script is finished a Save File Dialog pops up so you can save the CSV file:
And the resulting Excel Sheet:
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | # +----------------------------------------------------------------------------+ # | File : ParseBuildingBlocks.ps1 | # | Author : Remko Weijnen | # | Version : 1.00 | # | Purpose : Extract Application Data from RES WM Building Blocks and export | # | to CSV file. | # | | # | Synopsis: | # | Usage : Change $BBFolder to the directory with Building Blocks | # +----------------------------------------------------------------------------+ # | Maintenance History | # | ------------------- | # | Name Date Version Description | # | ---------------------------------------------------------------------------+ # | Remko Weijnen 07-12-2012 1.0 Initial Version | # | | # | | # +----------------------------------------------------------------------------+ # Folder with the exported Building Blocks $BBFolder = "c:\Users\rweijnen\Projecten\GHZ\BB\XML" # Application Type Enum $enum = " namespace Application { public enum Type { CitrixThinApp = 1, CitrixMsi = 2, CitrixWebLink = 3, LocalThinApp = 4, LocalMsi = 5, LocalWebLink = 6, LocalManual = 7 } }" Add-Type -TypeDefinition $enum -Language CSharpVersion3 # save file dialog, source: http://hackandflail.blogspot.nl/2010/08/powershell-open-file-dialog.html Function Get-SaveFile($initialDirectory) { [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null $SaveFileDialog = New-Object System.Windows.Forms.SaveFileDialog $SaveFileDialog.initialDirectory = $initialDirectory $SaveFileDialog.filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*" $SaveFileDialog.ShowDialog() | Out-Null $SaveFileDialog.filename } # Get all the XML Files $BB = gci $BBFolder -Filter '*.xml' # Array to hold the list of items $list = @() # Process XML Files foreach ($file in $BB) { # Show Progress... Write-Progress -Activity "Processing Building Blocks" -PercentComplete (($list.Count / $BB.Count) * 100) -Status $file.Name # Create Item $item = "" | Select-Object Application,AppType,Enabled,Thinapp,ThinAppName,Subscribed,Weblink,URL # Read file and cast to XML [xml]$xml = Get-Content (Join-Path $BBFolder $file) $config = $xml.respowerfuse.buildingblock.application.configuration $settings = $xml.respowerfuse.buildingblock.application.settings # Application Name $item.Application = $config.title # Is Application Enabled? $item.Enabled = $settings.enabled -eq "yes" # Is Application Subscribed? $item.Subscribed = $config.subscribed -eq "yes" # Is it a ThinApp? $item.Thinapp = $config.commandline -contains 'thinapp' # Is it a weblink? $item.Weblink = $config.commandline -contains 'IEXPLORE.EXE' if ($item.Weblink) {$link = $config.parameters} else {$link = ""} if ($item.Thinapp) { $item.Thinappname = $config.commandline } # Determine Application Type # We cannot determine difference between MSI Local or Manual Install Local if ($item.Thinapp -and !$item.Subscribed) { $item.AppType = [Application.Type]::CitrixThinApp } elseif (!$item.Thinapp -and !$item.Subscribed -and !$item.Weblink) { $item.AppType = [Application.Type]::CitrixMsi } elseif (!$item.Thinapp -and !$item.Subscribed -and $item.Weblink) { $item.AppType = [Application.Type]::CitrixWebLink } elseif ($item.Thinapp -and $item.Subscribed -and !$item.Weblink) { $item.AppType = [Application.Type]::LocalMsi } elseif (!$item.Thinapp -and $item.Subscribed -and $item.Weblink) { $item.AppType = [Application.Type]::LocalWebLink } else { $item.AppType = [Application.Type]::LocalMsi } if ($item.Thinapp) { $item.ThinAppName = $item.Thinappname } else { $item.Thinappname = "" } if ($item.Weblink) { $item.Url = $link } else { $item.url = "" } $list += $item } Write-Progress -Activity "Processing Building Blocks" -Completed:$true -Status "Completed" # Show Save File Dialog $filename = Get-SaveFile $BBFolder if ($filename) { # Sort the list by application name and save it to csv file $list | Sort-Object Application | Export-Csv -Delimiter ";" -NoTypeInformation -Path $filename } |
Leave a reply