Hosted Apps and Desktops - How to Fix Duplicate Offering Names

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 HAaD Offering Management Page.

Error Messages




Scan duplicate offerings in Citrix server

Use the Powershell script below and compare the Keys if it matches the Value(s) from the database.
  1. Add-PSSnapin Citrix.Broker.Admin.V2

  2. $DeliveryGroups = Get-BrokerDesktopGroup

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

  6.     ForEach($Key in $OfferingKeys) {
  7.         $Offering = New-Object -TypeName PSObject -Property @{
  8.             Key       = $Key
  9.             Name      = $DeliveryGroup.MetadataMap[$Key]
  10.             Duplicate = If($DeliveryGroup.MetadataMap[$Key] -in $Offerings.Name) { 
  11.                             $Offerings | Where { $_.Name -eq $DeliveryGroup.MetadataMap[$Key] } `
  12.                             | ForEach { $_.Duplicate = $true }
  13.                             $true
  14.                         } Else {
  15.                             $false
  16.                         }
  17.         }

  18.         $Offerings += $Offering
  19.     }

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

Example output:


In this case, there is a duplicate offering name '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).
  1. use olm
  2. select p.[Label], pr.[Name], pv.[Value]
  3. from Plans p
  4. join PropertyValues pv on pv.ObjectID = p.ObjectId
  5. join Properties pr on pr.PropertyID = pv.PropertyID
  6. where p.[Label] is not null
  7. and pr.[Name] = 'CitrixAppId'
  8. and p.[Label] like '%appname%'  --> Search application name with duplicate


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:
  1. Get-BrokerDesktopGroup -Uid [Uid] | Remove-BrokerDesktopGroupMetadata -Name '[Key]'
Example:
  1. 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.
  1. Get-BrokerDesktopGroup -Uid [Uid] | Remove-BrokerDesktopGroupMetadata -Name '[Key]&RelatedId'
Example:
  1. 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:
  1. $Uid  = [Uid]
  2. $GUID = "[Key]"
  3. $DGrp = Get-BrokerDesktopGroup -Uid $Uid
  4. $Keys = $DGrp.MetadataMap.Keys | Where { $_ -match $GUID }
  5. $Keys | ForEach { 
  6.     New-Object -TypeName PSObject -Property @{
  7.         Key   = $_
  8.         Value = $DGrp.MetadataMap[$_]
  9.     } 
  10. }
Example output:



If the value(s) is still valid, you can change the value of the offering name using the below command:
  1. Set-BrokerDesktopGroupMetadata -DesktopGroupId [Uid] -Name ‘[Key]' -Value "[Correct name]" 
Example:
  1. Set-BrokerDesktopGroupMetadata -DesktopGroupId 1 -Name ‘203404f4-c59a-4302-8579-4d635c84e203' -Value "Windows 10" 

    • Related Articles

    • Planned Retirement of Hosted Apps and Desktops Service

      Overlap between existing Atria service modules Atria has two core service modules used for managing Desktops, Applications and associated Resources.  These are known as “Citrix” Service, (CITRIX) and “Hosted Apps and Desktops” Service (HAAD) These ...
    • Migrate to a new Hosted Apps and Desktops Delivery Controller

      Prerequisite tools For each server that will have core components or web services installed, the below prerequisite items must be installed. From version v12.11+ the database installation should be run from the Provisioning Server, so prerequisite ...
    • Hosted Exchange Service Deployment

      Objective This article provides a guide to installing the Hosted Exchange service into the Atria Platform. Web Service and Schema Installation The first step for deployment of any new Service is to install the Web Service (if required) and its ...
    • Hosted Exchange Version Migration

      Overview Atria supports multi-Exchange version coexistence. There will be a time where you may want to upgrade/migrate a customer’s assigned version to a higher one. This article gives an overview of how Atria interacts with Exchange, considerations ...
    • How to Migrate from Hosted Exchange to Exchange Online

      Overview This article provides an example of how to migrate from the Atria Hosted Exchange Service to the Microsoft Online Service.  It will cover the change in service as well as data migration.  The process will use the following free Microsoft ...