I’ve had questions from Partners and Customers about how to enable the Desktop Experience Role after you’ve installed XenApp 6/6.5 or XenDesktop 7/7.1.  Needing to enable this role can happen for a number of reasons.

  1. You didn’t enable the feature during the Citrix software installation.
  2. You are installing the XenDesktop 7.x VDA for Desktop OS’s on a Server 2008 R2 machine (Server VDI), or
  3. maybe someone has disabled the service that controls the Themes.
  • If you haven’t installed the ServerVDI feature of the Virtual Delivery Agent (VDA), please see this article before you start the process below (http://support.citrix.com/proddocs/topic/xendesktop-71/cds-servervdi.html).  Basically you need to install ServerVDI from a command line to force the install of the Desktop VDA on the Server OS.  If you run through the standard install process it will install the ServerVDA instead of the desired DesktopVDA.  You also need to make sure you have not installed the RDS role on the VM before this process.

When I started looking into this, I thought installing the Feature through Server Manager would be good enough, but was wrong.  There’s also a service to be enabled.  I found instructions with pictures on the Citrix website (http://support.citrix.com/article/CTX129027) to enable all of this, but thought there must be a quicker way to do this and decided to write a script and post it for the world to have.

I hope this script works for you! Copy the text below and use in your own environment.  It is written in PowerShell with comment lines so it can be pasted directly into a .ps1 file as directed.

#

# WHAT DOES THIS DO?
#
# This script will enable the Desktop Theme for Windows 2008R2.
# This is required if you are using XD7/7.1 for Server VDI not Hosted Shared Desktop.
# or if you don’t enable the feature throught the Server VDA install
#
# WHAT IS SERVER VDI?
# Server VDI is where you install the Desktop VDA instead of the Server VDA for 1-to-1 user to machine connections.
# There could be licensing advantages or disadvantages from Microsoft using this Flexcast Delivery Method
# Please check with your Microsoft rep for more detailed licesing information
#
# NOTE:
# Before you start you must disable UAC or Add-WindowsFeature will fail with improper rights elevation priviledges
#
# HOW DO I DO THIS?
# 1)To enable the Desktop Theme you can copy the verbage below and paste it into the PowerShell command prompt.
# 2) You can also make 2 separate files that end in .ps1 as directed below
#
# GOTCHAS or ALTERNATIVES
# You must reboot between the steps to enable the Desktop Experience Windows Feature
# or else the Service doesn’t exist to Enable and Start
# You could also have a GPO that enables and starts the Themes Service automatically
# The GPO could also have the settings to apply the appropiate Theme for your users or organization
# There’s probably other ways to do this as well.
#

# NOTE: If you use the ps1 files you must manually allow the RemoteSigned Execution policy as listed below in the PowerShell prompt
Set-ExecutionPolicy RemoteSigned

# part 1 for DesktopExperiencePart1.ps1
# start script
import-module ServerManager
Add-WindowsFeature Desktop-Experience -reboot
# end script

# part 2 for DesktopExperiencePart2.ps1
# start script
Set-Service -Name Themes -StartupType Automatic
Start-Service Themes
Restart-Computer
# end script
# You may need to reboot to activate the Themes so I included it in this script

# Written by Dave Fiske – Sr. Systems Engineer, Citrix Systems, Inc.