-
Changing the Published Name of a Citrix XenDesktop Private Desktop
November 10, 2017
Citrix Virtual Apps and Desktops, PowerShell, XenApp/XenDesktop 7.0 - 7.7
Recently a customer had a need to change the Published Name property of a Private Desktop in Citrix XenDesktop. By default, the Published Name property is Null. This article will show you some tidbits I picked up and two lines of PowerShell you can use to change the published name property of either all or a subset of private desktops.
[Updated 8-Mar-2021: My friends at Ferroque Systems tell me they tested this on a current version of CVAD and the process in this article still works.]
What is a Private Desktop? Citrix explains it this way:
Private desktops are automatically created when a machine is added to a desktop group with a DesktopKind of ‘Private’, and these inherit default properties.
For this article, I created two Machine Catalogs each with three persistent machines with changes saved on the local disk as shown in Figure 1.
I also created two Delivery Groups as shown in Figure 2.
Some people believe that published private desktops use the Delivery Group’s name as the name the user sees in StoreFront and Receiver but that is not always the case. If no user assignment has been made, published private desktops, by default, use the Display name value from the Desktop Assignment Rule in StoreFront and Receiver as shown in Figures 3, 4, and 5.
As you can see from Figure 5, the Delivery Group’s name is NOT used in StoreFront and it is also not used in Receiver. Why? Because no user assignment has been made, as shown in Figures 6 and 7.
If a user assignment has been made (Figure 8), then the Delivery Group’s Published Name property value is used in StoreFront and Receiver (Figure 9).
Where did the Delivery Group’s Published Name value come from?
When you create a Delivery Group, the Published Name property gets its initial value from the Delivery Group’s Name property. If you later rename the Delivery Group, the Published Name property’s value is not changed. You can set the Delivery Group’s Published Name value to whatever value you want using the Set-BrokerDesktopGroup cmdlet.
Back to the Private Desktop name shown in StoreFront and Receiver.
If you just want the desktop’s name to show or if you allow users to use more than one desktop in a Delivery Group, then you can change the Published Name value using the Set-BrokerPrivateDesktop cmdlet.
If you have more than one Delivery Group with Private Desktops and only want this change made to a single Delivery group, that is very simple.
For this article, I only want one Delivery Group changed. One Delivery Group uses the naming scheme Persistent-## and the other uses testp-##. I want the testp desktops changed.
First, I will get all the private desktops showing only the DNSName, HostedMachineName, MachineName, and PublishedName properties as shown in Figure 10.
Get-BrokerPrivateDesktop | select dnsname,hostedmachinename,machinename,publishedname
This shows that none of the private desktops have a value for PublishedName.
Note: I removed the desktop assignment I made earlier.
If I launch all three desktops from StoreFront, Sign out from the desktop, and rerun the previous cmdlet, we get what is shown in Figure 11.
My experience is that even if I change the Published Name property’s value BEFORE I first launch a desktop, the Assignment Rule’s Display Name value is written in for the value of the private desktop’s Published Name.
I found I had to launch the private desktop FIRST and then I could change the Publish Name property.
To change the Published Name property, use the following two lines of PowerShell code as shown in Figure 12.
Note: To change the Published Name property for all private desktops, use $Pattern = “*”
$Pattern = "testp*" $Desktops = Get-BrokerPrivateDesktop -filter {HostedMachineName -like $Pattern} ; ForEach($Desktop in $Desktops) {Set-BrokerPrivateDesktop -MachineName $Desktop.MachineName -PublishedName $Desktop.HostedMachineName}
All the forum posts and blogs I have read on this want the Published Name property changed AFTER users have launched their private desktops. Please take note, if you changed the Published Name property BEFORE users launch their private desktop(s) for the FIRST time, the Published Name property’s value WILL get overwritten. Apparently, Citrix didn’t put in a safety check to see if the Published Name property has a value before they just blatantly overwrote whatever value was there. Bad job Citrix.
Thanks
Webster
One Response to “Changing the Published Name of a Citrix XenDesktop Private Desktop”
December 5, 2018 at 12:55 pm
Excellent work – maybe add the hint, that using “HostedMachineName” in the PowerShell script assumes, that the names within the hosting infrastructure match the Active Directory names.
It might be better to use the “MachineName” or “DNSName” property, like
$(($Desktop.DNSName -split “\.”)[0])
Cheers and thanks for providing all this content!