Skip to main content

Hosted Apps and Desktops - How to Fix Duplicate Offering Names

Overview

This article provides steps on how to fix the specific error message below when discovering offerings on the Hosted Apps and Desktops Offering Management Page.

Error Message

Fix Duplicate Offering Names

Fix Duplicate Offering Names

Scan duplicate offerings in Citrix server

Use the Powershell script below and compare the Keys if it matches the Value(s) from the database.

Add-PSSnapin Citrix.Broker.Admin.V2

$DeliveryGroups = Get-BrokerDesktopGroup

ForEach($DeliveryGroup in $DeliveryGroups) {
[PSObject[]]$Offerings = @()
[String[]]$OfferingKeys = $DeliveryGroup.MetadataMap.Keys | Where { $_ -notmatch '&' -and $_ -ne 'Version' }

ForEach($Key in $OfferingKeys) {
$Offering = New-Object -TypeName PSObject -Property @{
Key = $Key
Name = $DeliveryGroup.MetadataMap[$Key]
Duplicate = If($DeliveryGroup.MetadataMap[$Key] -in $Offerings.Name) {
$Offerings | Where { $_.Name -eq $DeliveryGroup.MetadataMap[$Key] } `
| ForEach { $_.Duplicate = $true }
$true
} Else {
$false
}
}

$Offerings += $Offering
}

If($Offerings.Duplicate -contains $True) {
Write-Host "Found duplicates for Delivery Group!`nDelivery Group: [Uid: $($DeliveryGroup.Uid) | Name: $($DeliveryGroup.Name)]" -ForegroundColor Red
$Offerings | Where { $_.Duplicate -eq $true } | FT
}
}

Example output:

Fix Duplicate Offering Names

In this case, there is a duplicate offering named 'Windows Server 2019'. Take note of the Delivery Group's Uid and the Keys (GUID) to compare it later to find which one is still valid.

Query from Database the Offerings and Associated GUID

Use SQL script below and take note of the Value(s).

use olm
select p.[Label], pr.[Name], pv.[Value]
from Plans p
join PropertyValues pv on pv.ObjectID = p.ObjectId
join Properties pr on pr.PropertyID = pv.PropertyID
where p.[Label] is not null
and pr.[Name] = 'CitrixAppId'
and p.[Label] like '%appname%' --> Search application name with duplicate

Fix Duplicate Offering Names

In the result, the valid GUID that was configured in Atria is shown.

Remove or rename duplicate offering name in Citrix server

For the example above, one of the values is not valid anymore. Execute below Powershell command to delete invalid metadata item:

Get-BrokerDesktopGroup -Uid [Uid] | Remove-BrokerDesktopGroupMetadata -Name '[Key]'

Example:

Get-BrokerDesktopGroup -Uid 1 | Remove-BrokerDesktopGroupMetadata -Name '203404f4-c59a-4302-8579-4d635c84e203'

Optional: For application offerings, there is a RelatedId key associated with the offering.

Get-BrokerDesktopGroup -Uid [Uid] | Remove-BrokerDesktopGroupMetadata -Name '[Key]&RelatedId'

Example:

Get-BrokerDesktopGroup -Uid 1 | Remove-BrokerDesktopGroupMetadata -Name '203404f4-c59a-4302-8579-4d635c84e203&RelatedId'

You can verify if there is a RelatedId key associated by executing below script:

$Uid  = [Uid]
$GUID = "[Key]"
$DGrp = Get-BrokerDesktopGroup -Uid $Uid
$Keys = $DGrp.MetadataMap.Keys | Where { $_ -match $GUID }
$Keys | ForEach {
New-Object -TypeName PSObject -Property @{
Key = $_
Value = $DGrp.MetadataMap[$_]
}
}

Example output:

Fix Duplicate Offering Names

If the value(s) is still valid, you can change the value of the offering name using the below command:

Set-BrokerDesktopGroupMetadata -DesktopGroupId [Uid] -Name ‘[Key]' -Value "[Correct name]" 

Example:

Set-BrokerDesktopGroupMetadata -DesktopGroupId 1 -Name ‘203404f4-c59a-4302-8579-4d635c84e203' -Value "Windows 10" 

If you have any questions or require any help or assistance, please contact us at support@getatria.com.