Pawel Serwan Blog

Citrix, Microsoft and other stuff

First Look: XenApp/XenDesktop 7.6 – Part 9 (PowerShell)


Welcome in the last part of the First Look series on XenApp/XenDesktop 7.6. I made a long break since last post but luckily I found time to finish the series. Today I would like to focus on PowerShell in Citrix XenApp/XenDesktop 7.6. First let’s see what we did already:

In the first part – we have installed first Delivery Controller and setup our new XenDesktop 7.6 site.

In the second part – we have configured first site.

In the third part – we prepared the template image of Windows Server 2012 R2 that will be used by MCS service for creation of new machines that will be hosting user desktops and applications.

In the fourth part – we have upgraded XenApp 6.5 server to XenApp 7.6.

In the fifth part – we have created machine catalogs and used previously prepared master image. We attached to the site as well upgraded XenApp 6.5 server.

In the sixth part – we have delivered applications to the end users by creating delivery groups.

In the seventh part – we have configured StoreFront so that end users could launch their apps.

In the eighth part – we checked how Connection Leasing really works.

In the ninth part – I would like to show you how you can use PowerShell in XenApp/XenDesktop 7.6.

As you I hope already know PowerShell became the industry standard when it comes to the management framework, at least in Windows world 🙂 And well Citrix is part of that world of course. Good to see then that XenApp/XenDesktop provide an SDK based on a number of Microsoft Windows PowerShell version 3.0 snap-ins that allows you to perform the same tasks as you would with the Citrix Studio console, together with tasks you cannot do with Studio alone. To use SDK you need to just launch PowerShell console or PowerShell ISE if you would like to have PowerShell editor where you can write you scripts on your server with installed Citrix XenApp/XenDesktop 7.6. Then you have to add Citrix snap-ins.


What is important to underline. Due to change of management architecture from IMA to FMA PowerShell SDK has changes as well. So you can forget the cmdlets you were learning so heavily while working with XenApp 6.x or XenDesktop 5.x. It is high time to learn new ones 🙂

Key differences between the XenDesktop 5 and XenDesktop 7 SDK

  • New high-level SDK — XenDesktop 7 provides a new high-level SDK that enables you to script and automate site creation and maintenance quickly and easily. The high-level SDK insulates you from much of the complexity of the low-level SDKs, such that you can create a new site simply by running two cmdlets.
  • New low-level SDKs — Individual low-level SDKs are provided for the new XenDesktop 7 services, including a dedicated and enhanced SDK for the Delegated Administration Service (DAS), which was previously part of the Broker SDK in XenDesktop 5. There are also SDKs for new features including the Monitor Service, Environment Test, and Configuration Logging.
  • Windows Server OS Machine catalogs and delivery groups — You can use the XenDesktop 7 SDK to deliver cost-effective applications and desktops hosted on server operating systems.
  • Desktop OS Machine applications — Desktop OS Machine applications have changed significantly at the SDK level. If you have existing scripts for running applications on Desktop OSs, you will have to update these scripts for XenDesktop 7 as there is little backwards compatibility.
  • Apply settings to machines in Delivery Groups — In XenDesktop 7, using configuration slots, you can apply settings to machines in a specific delivery group, rather than to all machines in a site. This enables you to configure, for a given delivery group, which settings apply to that group. A number of pre-defined configuration slots are provided that contain different types of settings, such as settings for StoreFront addresses for use with Receiver or App-V publishing server locations. You can use one collection of settings from a slot to affect only a particular delivery group, and a different collection of settings from the same slot to affect another delivery group. You can use names appropriate to your particular deployment; for example, “Sales Department policy.”
  • Catalog types replaced — In XenDesktop 7, catalog types have been replaced by catalogs with individual properties. However, for backwards compatibility, you can still use existing scripts that employ catalog types, such as single image (pooled) and thin clone (dedicated) etc., but internally these are converted into sets of properties.
    Caution: Backwards compatibility with XenDesktop 5 catalog types has been maintained where possible and practicable. However, when writing new scripts, do not use catalog types; instead, specify catalogs with individual properties.
  • Desktop object replaced — In XenDesktop 5, the Desktop object is one of the main types of SDK object used in Broker SDK scripts. The Desktop object describes both the machine and the session on the machine. In XenDesktop 7, this object is replaced by the Session object and the Machine object, both of which have been expanded to do the work of the Desktop object. However, for backwards compatibility, you can still use existing scripts that employ the Desktop object.
    Caution: Backwards compatibility with XenDesktop 5 has been maintained where possible and practicable. However, when writing new scripts, do not use the Desktop object; instead, specify Session and Machine objects.

Under below link you can find an explanation of XenApp/XenDesktop 7.x administration model:

The PowerShell modules for Xenapp/XenDesktop 7.6 can be found here:

C:\Program Files\Citrix\XenDesktopPoshSdk\Module

We have the following list of modules that we can use:

  • Citrix.AdIdentity.Admin.V2
  • Citrix.AppV.Admin.V1
  • Citrix.Broker.Admin.V2
  • Citrix.Configuration.Admin.V2
  • Citrix.ConfigurationLogging.Admin.V1
  • Citrix.DelegatedAdmin.Admin.V1
  • Citrix.EnvTest.Admin.V1
  • Citrix.Host.Admin.V2
  • Citrix.MachineCreation.Admin.V2
  • Citrix.Monitor.Admin.V1
  • Citrix.Storefront.Admin.V1

Let’s check how many cmdlets can we use in our awesome scripts 🙂

xd2As you see above we have 718 cmdlets for our use which is quite impressive number. If you would like to read more about the cmdlets you can visit the E-docs page:

or you can just get that help from PowerShell console.

xd3As you see you get very detailed explanation of what that cmdlet can do for you as well as a few examples that will show you how to use that cmdlet to get some relevant information.


The other thing that I just simply love in XenApp/XenDesktop 7.6 is a Script Generator. If you would like to automate some thing that you do quite often in Citrix Studio you can now use instead Powershell script. And what is even better Citrix Studio will generate it for you. Isn’t that great? No more hours spent on developing Powershell scripts. They are now on your hand – just grab it and use as you want 🙂 You will have more time to learn other things about XenApp/XenDesktop.

Where to find those generated scripts? Launch Citrix Studio. Do what you would like to do and then navigate to the main window of console. You may notice there a tab called PowerShell. Click it and you will find PowerShell script ready for use. Excelllent 🙂


As you see it is very easy. But still I encourage you to try on your own. Write some simple script and check how it works. The best way to learn something is by doing something.

That’s all I wanted to show you regarding PowerShell in XenApp/XenDesktop 7.6. Apparently we get to the final of our First Series. In the next post I will do a summary of our whole series. Hope you like it!


2 thoughts on “First Look: XenApp/XenDesktop 7.6 – Part 9 (PowerShell)

  1. Pingback: First Look: XenApp/XenDesktop 7.6 – Series summary | pawelserwan

  2. Nice article


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s