MSEndpointMgr
Home » Microsoft Endpoint Manager » ConfigMgr » Application Management » Use PowerShell to convert an Application CI Unique ID to Display Name

Use PowerShell to convert an Application CI Unique ID to Display Name

When I was browsing the net, I stumbled upon a script that would convert a ContentID to DisplayName and PackageID. This got me thinking that when you’re troubleshooting Application deployments, you sometimes need to check which Application it is that’s being shown with it’s CI Unique ID in the log files. In certain log files, you can see the name directly, but not in all of them. So I decided to create a script that would convert the CI Unique ID to the application Display Name.
If you look in the ConfigMgr console, under Software Library – Application Management – Applications, you can add a column called CI Unique ID which will look like the following:
125_1
As shown in the picture above, these are the CI Unique IDs for each Application. It’s those that you will see in the client log files. In order to use PowerShell to convert these non-readable IDs to something more easier on the human eye, save the below script as ConvertFrom-CMApplicationCIUniqueID.ps1 and store it in C:\Scripts.
1. Open an elevated PowerShell console and browse to C:\Scripts, or where you saved the script.
2. Run the following command:

.\ConvertFrom-CMApplicationCIUniqueID.ps1 -SiteServer CAS01 -CIUniqueID "Application_e4f48c57-a4e2-4f32-99f1-f8e13a10dd39" -Verbose

125_2
It’s also possible to pass a string array to the CIUniqueID parameter, like this:

.\ConvertFrom-CMApplicationCIUniqueID.ps1 -SiteServer CAS01 -CIUniqueID "Application_e4f48c57-a4e2-4f32-99f1-f8e13a10dd39","Application_f7cdd400-ed5a-473b-a1ce-d3a0cc6643d2" -Verbose

125_3
As you may have noticed, I’m not using the whole CI Unique ID when I run the PowerShell script, instead I’m only using the ‘Application_xxx’ portion. The script performs a query trying to match the string from the CIUniqueID parameter with the complete CI Unique ID received from the SMS Provider. Therefor, you could take an portion of the CI Unique ID and use in this script.

<# .SYNOPSIS Convert a CI Unique ID to Application Name and Version in ConfigMgr 2012 .DESCRIPTION This script will convert a CI Unique ID shown in for example the AppIntentEval.log client log file to an Application Name and Version in ConfigMgr 2012 .PARAMETER SiteServer Site server name with SMS Provider installed .PARAMETER CIUniqueID Specify the CI_UniqueID for the application to be translated .EXAMPLE .\ConvertFrom-CMApplicationCIUniqueID.ps1 -SiteServer CM01 -CIUniqueID "Application_f7cdd400-ed5a-473b-a1ce-d3a0cc6643d2" -Verbose Converts the CI Unique ID (part of) 'Application_f7cdd400-ed5a-473b-a1ce-d3a0cc6643d2' on a Primary Site server called 'CM01': .NOTES Script name: ConvertFrom-CMApplicationCIUniqueID.ps1 Author: Nickolaj Andersen Contact: @NickolajA DateCreated: 2015-02-10 #>
[CmdletBinding(SupportsShouldProcess=$true)]
[OutputType([PSObject])]
param(
    

[parameter(Mandatory=$true, HelpMessage=”Site server where the SMS Provider is installed”)]

[ValidateScript({Test-Connection -ComputerName $_ -Count 1 -Quiet})] [ValidateNotNullOrEmpty()] [string]$SiteServer,

[parameter(Mandatory=$true, HelpMessage=”Specify the CI_UniqueID for the application to be translated”)]

[ValidateNotNullOrEmpty()] [string[]]$CIUniqueID ) Begin { # Determine SiteCode from WMI try { Write-Verbose “Determining SiteCode for Site Server: ‘$($SiteServer)'” $SiteCodeObjects = Get-WmiObject -Namespace “root\SMS” -Class SMS_ProviderLocation -ComputerName $SiteServer -ErrorAction Stop foreach ($SiteCodeObject in $SiteCodeObjects) { if ($SiteCodeObject.ProviderForLocalSite -eq $true) { $SiteCode = $SiteCodeObject.SiteCode Write-Debug “SiteCode: $($SiteCode)” } } } catch [Exception] { Throw “Unable to determine SiteCode” } } Process { $ResultsList = New-Object -TypeName System.Collections.ArrayList foreach ($ID in $CIUniqueID) { Write-Verbose -Message “Query: SELECT * FROM SMS_ApplicationLatest WHERE CI_UniqueID like ‘%$($ID)%'” $Application = Get-WmiObject -Namespace “root\SMS\site_$($SiteCode)” -Class “SMS_ApplicationLatest” -ComputerName $SiteServer -Filter “CI_UniqueID like ‘%$($ID)%'” if ($Application -ne $null) { $PSObject = [PSCustomObject]@{ DisplayName = $Application.LocalizedDisplayName Version = $Application.SoftwareVersion CI_UniqueID = $Application.CI_UniqueID } $ResultsList.Add($PSObject) | Out-Null } else { Write-Verbose -Message “Unable to find an application matching the CI_UniqueID with ‘$($ID)'” } } Write-Output $ResultsList }

(4865)

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.

Add comment

Sponsors

Subscribe

Do you want to be notified of new posts on our site?

Please enter your email address below:

Categories

MSEndpointMgr.com use cookies to ensure that we give you the best experience on our website.