Monday, May 28, 2012

Citrix and Powershell Remoting


A person who never made a mistake never tried anything new”
                                                                                                                                                                                -Albert Einstien

In this one, I will try to show the good old PowerShell Remoting and Citrix Remoting. Please note that you can only use Citrix Remoting only if you have XenApp 6.5 Servers running in your farm. If you have XenApp 6 or below versions supported by Citrix then you  have to rely on PowerShell remoting.

If you want to know about PowerShell Remoting then I highly suggest the following free-ebooks

MVP Ravikanth’s “Layman’s Guide to PowerShell Remoting

PowerShell Guru MVP Don Jones & MVP Tobias Weltner’s “Secrets of PowerShell Remoting


I have a Lab Setup with:

·         domain name …….(cool isn’t it :P )

·         Administrator Workstation named “POWERSHELL” (PowerShell SDK for XenApp 6.5 installed )

·         Remote XenApp 6.5 Server “CTXXENAPP01” with PSRemoting enabled.

·         User POSH\201210 has  full Farm Admin privileges.


Citrix with PowerShell Remoting

Open the PowerShell Console. And create a  New PowerShell Session in the remote Citrix XenApp Server using the full Farm Administrator Credentials


After Opening the PowerShell Session in the Remote Citrix Server. Enter the Session using the –Id parameter.  Once you enter the Remote PSSession the console is prepended with the Remote Citrix XA Server Name .


Now , Get all the Snap-ins available in the Citrix XA Server. The following snapshot shows the Snap-ins registered with the Citrix PowerShell SDK , the ones we are interested in are Citrix.Common.Commands, Citrix.Common.GroupPolicy  and Citrix.XenApp.Commands.


 Now load the specific Snap-ins one-by-one or just add them using a wild-card (your choice). Notice that I had Citrix WorkFlow Studio installed too in my Remote Citrix XA Server, so those snap-in also get loaded if I use  a wild-card.


After the Citrix XA Snap-ins are loaded, to have a look at  all the new cmdlets available to manage XA Farm. You can use noun “XA*” with Get-Command because Citrix Cmdlets have XA prepended in the Noun part of Verb-Noun naming convention to easily identify them. There is also a cmdlet that comes with these Snap-ins Get-CtxCommand  which does the same.


Now Citrix XenApp Server is on-demand application delivery solution. So it deals mostly with administration of published Applications. So let’s search something like XAApplication with Get-Command. This will yield all the cmdlets that are available to administer Applications. 


Now time to explore.  The best thing about PowerShell is it’s documentation right. Don’t Worry Citrix also provides you a great Offline help documentation. Now you can look at the examples and get what the cmdlet does for you.


Viewing the Examples. Pretty self explanatory examples …I guess J


Now let’s execute a simple cmdlet Get-XAApplication. Now this cmdlet retrieves all the published Application informationclip_image018

 If you wanted a detailed information then you could use Get-XAApplicationReport.


The best thing about using PowerShell is whatever you have learned ….can be incorporated here too. For example in following example Invoke-Command is used to retrieve the published application information from the remote Citrix XA server and then that information is being piped into Out-file cmdlet to store it into a text file.

This is a very naïve example here but look at the Power it holds for Citrix XA Farm Admins. Suppose you wanted to get the list of  all the published applications in different farm ,  generate a report for Server memory  Optimization Information , retrieve Citrix Load Evaluators and much more.



A Little bit on Citrix Remoting

XenApp 6.5  PowerShell  SDK  for Citrix comes with a brand new feature Remoting , which was earlier not present in the XenApp 6 PowerShell SDK. All the cmdlets shipped with the SDK now support a –computername  parameter  which indicates  to the cmdlet to execute remotely. Now this has  a huge impact , such that now I can install the PowerShell SDK on any machine ( Windows Machine) running PowerShell v2.0 and manage my farm from there. Note that no additional configurations are needed in the client or server.

XenApp 6.5 implements this new feature by introducing a new Windows Communication Foundation (WCF) service named Citrix XenApp Commands Remoting. This service implements Remoting in the XenApp 6.5.

Following is a status of the Citrix Remoting Service running on the XenApp 6.5 Server.


To use Citrix Remoting , you don’t need to install the PowerShell SDK on the Remote Citrix XA Server instead you install it on the local  Administrator Workstation and load the snap-ins and use the commands like native PowerShell cmdlets specifying the remote Citrix XA Server to contact using –computername parameter. It’ll look something like this


I have tested this one and this works fine as well, But as of now didn’t had a proper screenshot. I will try to cover this one later with proper steps.



Deepak Singh Dhami
Deepak Singh 


  1. Thank you for sharing this information and Very good looking blog. Citrix Xendesktop Certification

  2. Article is quite good. Pegasi Media is a b2b marketing firm that has worked with many top organizations. Availing its email list is fast, simple, convenient and efficient. Appending services adds the new record as well as fills up the fields that are missing. Pegasi Media Group also perform Data Refinement, Data building, Data Enchancement, and Data De-Duplication. Database marketing is a form of direct market in which the customers are contacted through their email addresses with the help of the database. There is a scope for email marketing to generate personalized communication with the clients in order to promote your sales.
    Citrix XenDesktop Users