Category Archives: XenDesktop

PowerShell and XenDesktop at the UK PowerShell UserGroup – 4th July 2012

I’ll be presenting tonight for the UK PowerShell UserGroup on using PowerShell to administer your XenDesktop environment. I’ll be providing some info on how the management of XenDesktop is built on top of PowerShell and how to get started using it. Details from Richard’s site below:


Reminder–UK PowerShell UserGroup–July 2012 meeting

When: Wednesday, Jul 4, 2012 8:30 PM (BST)
Where: Virtual


Jonathan Medd will be talking about using PowerShell to administer a XenDesktop environment


Richard Siddaway has invited you to attend an online meeting using Live Meeting.
Join the meeting.
Audio Information
Computer Audio
To use computer audio, you need speakers and microphone, or a headset.
First Time Users:
To save time before the meeting, check your system to make sure it is ready to use Microsoft Office Live Meeting.
Unable to join the meeting? Follow these steps:

  1. Copy this address and paste it into your web browser:
  2. Copy and paste the required information:
    Meeting ID: R2TT4R
    Entry Code: Jc-‘8JM;W

If you still cannot enter the meeting, contact support

Microsoft Office Live Meeting can be used to record meetings. By participating in this meeting, you agree that your communications may be monitored or recorded at any time during the meeting.

Automating the Install of XenDesktop DDC with PowerShell

I had a need to automate the installation of Citrix XenDesktop DDC including using some of the different available install options.

XenDesktopServerSetup.exe is the command line tool to use. Running XenDesktopServerSetup.exe /? displays most of the options that can be used, however I found a couple missing which are documented here.

The Install-XenDesktopDDC function below will enable you to install XenDesktop with different options. For instance, to install all components, but no SQL Express and see the install steps:

Install-XenDesktopDDC -noSQL -Verbose

The installation can be confirmed by checking for the presence of Citrix services:

Get-Service Citrix*

or looking in the installation folder:

To install a subset of components using a specified install media location and a custom install path, this time including the default SQL Express install:

Install-XenDesktopDDC -components "CONTROLLER,DESKTOPSTUDIO" -installMediaLocation "X:\Citrix\XenDesktop\5.6" -customInstallLocation "C:\Citrix"

(Note: I tested the below Install-XenDesktopDDC function with XenDesktop 5.6. It should work with other 5.x versions, but I have not tested those)

function Install-XenDesktopDDC {
Install Citrix XenDesktop Desktop Delivery Controller

Install Citrix XenDesktop Desktop Delivery Controller, with options for different installation types

.PARAMETER components
Specify a comma seperated list of Citrix XenDesktop DDC Components to install

Prevents the installation of SQL Server Express

.PARAMETER installMediaLocation
Specify the location of the Citrix XenDesktop install media, otherwise the CDRom drive is used

.PARAMETER customInstallLocation
Specify the location to install Citrix XenDesktop DDC to

Install-XenDesktopDDC -noSQL

Install-XenDesktopDDC -components "CONTROLLER,DESKTOPSTUDIO" -installMediaLocation "X:\Citrix\XenDesktop\5.6" -customInstallLocation "C:\Citrix"





function Get-CDRomDriveLetter {
	([System.IO.DriveInfo]::GetDrives() | Where-Object {$_.DriveType -eq "CDRom"}| Select-Object -ExpandProperty RootDirectory).Name

function Get-ProcessorArchitecture {
    if ((Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq "64-bit"){
    else {
Write-Verbose "Determining Install Media Location"
if (!$installMediaLocation){
	$CDRomDriveLetter = Get-CDRomDriveLetter
	$processorArchitecture = Get-ProcessorArchitecture
	$installMediaLocation = "$CDRomDriveLetter$processorArchitecture\XenDesktop Setup\"
else {
	$processorArchitecture = Get-ProcessorArchitecture
	$installMediaLocation = $installMediaLocation + "\$processorArchitecture\XenDesktop Setup\"

if (!(Test-Path $installMediaLocation)){
	throw "Path to installation media is not valid"

Write-Verbose "Setting Install Arguments"
if ($customInstallLocation){
	if (!(Test-Path $customInstallLocation)){
	throw "Path to custom install is not valid"
	if ($noSQL){
		$installerArguments = ('/QUIET','/INSTALLDIR',$customInstallLocation,'/COMPONENTS',$components,'/CONFIGURE_FIREWALL','/NOREBOOT','/NOSQL')
	else {
		$installerArguments = ('/QUIET','/INSTALLDIR',$customInstallLocation,'/COMPONENTS',$components,'/CONFIGURE_FIREWALL','/NOREBOOT')
else {
	if ($noSQL){
		$installerArguments = ('/QUIET','/COMPONENTS',$components,'/CONFIGURE_FIREWALL','/NOREBOOT','/NOSQL')
	else {
		$installerArguments = ('/QUIET','/COMPONENTS',$components,'/CONFIGURE_FIREWALL','/NOREBOOT')

Write-Verbose "Running the XenDesktop Installation"
Push-Location $installMediaLocation
Start-Process -FilePath XenDesktopServerSetup.exe -Wait -ArgumentList $installerArguments

Citrix XenDesktop 5 Training from TrainSignal

I had a, shall we say urgent, need to get up and running with Citrix XenDesktop 5 in a very short space of time. Having used some of the TrainSignal products before  and had a very good experience with them my first thought was to head over to their site and see if they had anything available. Thankfully, they have courses for both XenDesktop 4 and 5 so I was able to get hold of the XenDesktop 5 course. As with all the other courses you get both online access and a DVD with formats suitable for desktop / laptop and smartphone / tablets. (In this instance I only had online access, however was able to successfully stream the entire course to an iPad on 3G while on train journeys)

The topics covered on the course are listed below. Lessons 5 – 13 were those that I initally needed to get through quickly so focused on those and found that they covered well the significant part of what I needed to know.

Citrix XenDesktop 5 Training – Course Outline

Lesson 1 – Getting Started with Citrix XenDesktop 5 Training
Lesson 2 – Lab Setup
Lesson 3 – The Course Scenario
Lesson 4 – Introduction to Desktop Virtualization
Lesson 5 – Planning Provisioning Server Deployment
Lesson 6 – Installing and Configuring Provisioning Server
Lesson 7 – Creating vDisks and Configuring Target Devices
Lesson 8 – Managing vDisks, Target Devices, Servers and Printers
Lesson 9 – Configuring Provisioning Server High Availability
Lesson 10 – Planning XenDesktop 5 Deployment
Lesson 11 – Installing and Configuring XenDesktop 5 – Part 1
Lesson 12 – Installing and Configuring XenDesktop 5 – Part 2
Lesson 13 – Managing XenDesktop 5
Lesson 14 – Monitoring and Troubleshooting XenDesktop 5
Lesson 15 – Working with Citrix Receiver
Lesson 16 – Working with Profile Manager
Lesson 17 – Upgrading from XenDesktop 4
Lesson 18 – Preparing for the Citrix XenDesktop 5 Administration (A19) Exam
Lesson 19 – Next Steps

Citrix XenDesktop 5 Training – Bonus Lessons

Lesson 20 – Configuring NetScaler Access Gateway Enterprise Edition
Lesson 21 – Working with XenDesktop Setup Wizard

I’ve subsequently been through most of the rest of the lessons and found that it gives you excellent coverage of the XenDesktop product. I enjoyed Elias’ style of training; good explanations and he is always very positive about each lesson and the product itself.

The only thing I think is possibly missing from the course is that it would be worth a lesson on the XenDesktop PowerShell snapins. Since the entire management of the product is built on top of PowerShell it is worth knowing at least how to get started with this topic, even if you are using the GUI to demonstrate the rest of the training. An introduction to how to get started with the PowerShell snapins and a few basic examples would be a useful addition.

If you have a need to learn about XenDesktop then I would highly recommend that you consider using this course. I think TrainSignal have put themselves in a good place providing these two courses since in terms of book availability (which you could either view in terms of competition or complimentary) there are not many tech books available on this subject, although I notice that Elias has ‘Mastering Citrix XenDesktop‘ scheduled to come out later this year.

PowerShell Quick Tip: Converting a String to a Boolean Value

Some PowerShell cmdlets include switch parameters, i.e. no arguments are typically supplied to them – they are either True / On when they are present and False / Off when they are not. However, it is also possible to explicitly specify them with $true and $false, e.g.

-switchparameter:$true  or


Typically you would not use this when working manually at the console, but what if you needed to automate a task using a switch parameter and set it to be On or Off based on values from a CSV or XML file, i.e. you supply the true or false as a string?

This can lead to some initially confusing behaviour; look at this example.

$persistent = “False”


PowerShell appears to have converted our ‘false’ string to a Boolean ‘true’, not what we were expecting! This is because PowerShell will convert any string greater than 0 characters to a Boolean ‘true’, behaviour which is consistent across other programming languages.

So there are a couple of ways round this, either change your data to an empty string (which may not be possible of course)….

$persistent = “”


or use the .Net System.Convert ToBoolean method:

$persistent = “False”


Looking at a practical example of how you might use this take a look at working with one of the Citrix XenDesktop providers to create a Hypervisor Connection (more on this topic to come)

New-Item -Path xdhyp:\Connections –Name $Name –HypervisorAddress $HypervisorAddress –UserName $UserName –Password $Password –ConnectionType $ConnectionType –Persist: ([System.Convert]::ToBoolean($persistent))

A more detailed explanation of this topic is well written up by Kirk Munro