Wilco van Bragt - LinkeIn Wilco van Bragt - Twitter rssa 

Different Desktop Name is shown to the user within the Citrix Portal

I think most of the Citrix admins have already seen this behavior but did not bother much as it was just an IT admin that has the issue or a few sporadic users. However in some cases it can hit a lot of users and you need to do something about it. At a customer we run into this issue during the migration to Citrix Cloud, so I quickly created a script to fix this for their scenario. In this small article I will explain why the behavior is there and of course the script to fix it quickly.

 

Why this is happening?




First let’s start with explaining why this behavior is there. The behavior is there when you using assigned VDIs, in other words a user will get the same VDI each time he/she/ze logs on. When creating a Delivery Group you also need to define at least one Desktop Assignment configuration. In theory you can have more, but I expect that in most organizations there is one Desktop Assignment per Delivery Group. In most situations this is the name the IT organization would like to shown to the end user and differs from the Delivery Group name.

DifferentDesktopName1

The most used method with assigned VDIs is adding an Active Directory group to the Delivery Group with the users who will use this VDI. When the users logs on the first time and select that specific icon from the portal a free desktop will be picked by CVAD and assigned to the user. In that case the users see the name provided configured at the Desktop Assignment part.

However when you already pre-assign a VDI to the user within the Delivery Group the Desktop Assignment name is not used, but a Publishedname object in the Delivery Group. By default has the same value of the name of Delivery Group. I don’t understand that the developers at Citrix thought this make sense or see a benefit for this, but it is there for a long time so it is as it is.  

In one of my projects we are moving from an on-prem Control Plane to the Citrix Cloud CVAD service, while maintaining the VDIs on their current (on-prem) location. Logically in such scenario you want the user to have the same VDI back, so in the Delivery Group in the CVAD service the user need to pre-assigned (another article will be on-line soon to show how we did that including scripts) and so will see the Delivery Group Publishedname instead of the Desktop Assignment name the user is used to see before. Logically we needed to fix this, so users will not be confused and support tickets will be created during the migration.

How to fix it?

Logically I expected I was not the first one with this issue and when I was not fully certain where the behavior came from, I logically did a search on the almighty Internet. I stumbled quickly across an article of well-known Carl Webster with a similar situation. The article showed that the situation is even more complicated as the Publishedname is written to another object after the initial assignment. Carl’s working solution was after fixing it after the first initial assignment, but with thousands of VDIs and 25+ Delivery Groups this was not I was looking for as that made the migration script more complex. See for the details the article by Carl at https://carlwebster.com/changing-published-name-citrix-xendesktop-private-desktop/.

As we always have a one-to-one relation of the Delivery Group and Desktop Assignment, we decided to rename the Delivery Group Publishedname to the same name as stated within the Desktop Alignment. As we had quiet a lot of Delivery Groups it made sense to quickly created a script to arrange that.

The script requires one parameter the name of the Delivery Group, where the Publishedname should be adjusted. From this Delivery Group the UID will be stored. With this UID the corresponding Desktop Assignment can be determined and from that Desktop Assignment object the value of the PublishedName property extracted. In the last step the value will be written to the Delivery Group property PublishedName arranging that the same name is shown to the end-users when pre-assigning VDIs. The script is available below and can be (re)used for your convenience. This script should be run before users are accessing the VDIs, so I advise to run it directly after creating the Delivery Group.

##############################################################################################

# Scriptusage: Change Publish Name of the Delivery Group to the same as the Desktop Assignment Name
# Author: Wilco van Bragt
# File: ChangeDGPublishNametoDesktopName.ps1
# Version: 0.1
# Date last adjusted: 09 August 2021
# Adjusted by: Wilco van Bragt
##############################################################################################
# Execution: ./ChangeDGPublishNametoDesktopName.ps1 <<DeliveryGroupNameinCitrixCloud>>
# Requirements:
#     1) Delivery Group already created
#     2) Desktop Assignment already created ###############################################################################################################################################################################

#Load Citrix modules
add-pssnapin citrix*

# Logon to Citrix Cloud via the API.
# Authentication Profile have been previously created via
# Set-XDCredentials -CustomerId "xxxxxxx" -SecureClientFile "D:\Citrix\secureclientnonprd.csv" -ProfileType CloudAPI -StoreAs "nonprd"
Get-XDAuthentication -ProfileName "nonprd"

#Set DeliveryGroupName specified as argument as variabele
$DeliveryGroupName=$args[0]

#Get the DeliveryGroup properties for determining the UID, needed to get the corresponding Desktop Assignment rule later in the script
$DGprop=Get-BrokerDesktopGroup -Name $DeliveryGroupName
$DGUID=$DGprop.uid

#Get the Published AssingmentName properties for getting the PublishedName based on the UID of the Delivery Group
$PublishAssignment=Get-BrokerAssignmentPolicyRule -Filter {DesktopGroupUid -eq $DGUID}
$PublishName=$PublishAssignment.PublishedName

#Set the Publish Name of the Delivery Group to the same Name as the Desktop Assigment Name
Set-BrokerDesktopGroup $DeliveryGroupName -PublishedName "$PublishName"

Summarization

The way of storing and using the display name shown to the user is to say it nicely a bit weird and can cause strange situations. With the script we are aligning the values on the Desktop Assignment and Delivery Group properties arranging that the user always has the same name independent on the assignment of the VDI.