Documenting a Citrix XenApp 5 Farm with Microsoft PowerShell

A customer site I was at recently needed their XenApp 5 farm documented. I remembered reading about Citrix having some PowerShell “stuff” for XenApp 5 so I started searching. I came across a short article by Michael Bogobowicz Getting a Farm Inventory With XenApp 6 PowerShell Scripting. That short article really piqued my interest. I took Michael’s little script as the starting point to learn Microsoft’s PowerShell. With some help from PowerShell MVP and fellow CTP Brandon Shell and a lot of help from Exchange MVP Michael B. Smith, I turned the original script into over 2000 lines of PowerShell to thoroughly document a XenApp 5 farm.

NOTE: This script is continually updated.  You can always find the most current version by going to http://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/

This article will focus only on XenApp 5. There is already an article for XenApp 6 and there will be an article for XenApp 6.5.

The prerequisites to follow along with this article are:

  • A server, physical or virtual, running Microsoft Windows Server 2003 or Windows Server 2008
  • Citrix XenApp 5 for Windows Server 2003 or Windows Server 2008 installed

My lab for this article consists of:

  • Windows Server 2008 R2 Domain Controller
  • Windows Server 2008 R2 SQL Server
  • Windows Server 2003 Standard 32-bit with XenApp 5 and HRP7
  • Windows Server 2003 Standard 64-bit with XenApp 5 and HRP7
  • Windows Server 2008 Standard 32-bit with XenApp 5 and HRP1
  • Windows Server 2008 Standard 64-bit with XenApp 5 and HRP1

The two different XenApp 5 versions are in their own XenApp farm.

In this article, we will be installing the Citrix XenApp Commands Technology Preview (v3).

My initial goal was to see if I could walk down the nodes in the Delivery Services Console (Figure 1), or the Access Management Console (Figure 2), and see if I could document every nook and cranny.

Figure 1

Figure 2

Before we can start using PowerShell to document anything in the XenApp 5 farms we first need to install the XenApp Commands Technology Preview (v3). From your XenApp 5 server, go to https://dl.dropboxusercontent.com/u/43555945/Citrix.XenApp.Commands.CTP3.zip (Figure 3). Note: A MyCitrix.com login is required.

Figure 3

Click on Download and extract the file to C:\XA5CTP. You can now close your Internet browser.

For a 32-bit server, click Start, Run, type in C:\XA5CTP\Citrix.XenApp.Commands\Citrix.XenApp.Commands.Install_x86.msi and press Enter .

For a 64-bit server, click Start, Run, type in C:\XA5CTP\Citrix.XenApp.Commands\Citrix.XenApp.Commands.Install_x64.msi and press Enter .

Click Run (Figure 4).

Figure 4

Select I accept the terms of this license agreement and click Install (Figure 5).

Figure 5

After a few seconds, the installation completes. Click Finish (Figure 6).

Figure 6

You now have new Start Menu items under All Programs, Citrix. Windows Server 2003 is shown in and Windows Server 2008 is shown in .

Figure 7

Figure 8

The menu item that says Windows PowerShell with XenApp Commands (CTP3) will be the one we use for this article. Click Start, All Programs, Citrix, XenApp Commands, Windows PowerShell with XenApp Commands (CTP3). A PowerShell session starts with the Citrix PowerShell modules already loaded.

,

About Carl Webster

Webster is a Sr. Solutions Architect for Choice Solutions, LLC and specializes in Citrix, Active Directory and Technical Documentation. Webster has been working with Citrix products for many years starting with Multi-User OS/2 in 1990.

View all posts by Carl Webster

14 Responses to “Documenting a Citrix XenApp 5 Farm with Microsoft PowerShell”

  1. Rakesh Says:

    recently I downloaded XenApp 5 Powershell from http://blogs.citrix.com/2010/09/14/xenapp-5-powershell-sdk-tech-preview-3-released/
    After installing it, i observed that the program load approximately 15 to 30 mints
    Is there anything that can save my time??

    Reply

  2. Hilary Clegg Says:

    There is a new link to download the required XenApp commands CTP 3. I got this link from http://blogs.citrix.com/2010/09/14/xenapp-5-powershell-sdk-tech-preview-3-released/. The new link is https://citrix.sharefile.com/d/s2f4bd37f04c4836b.

    Reply

  3. Cata Says:

    Hey Carl, I know this article is referencing older technology (which is actually still being used at my new/current job :)) …. but any idea if I can find anywhere the Powershell SDK for XenApp 5 ???? 🙁 Maybe you have a copy saved somewhere ? Citrix doesn’t offer it anymore.. While I work on the migration to a newer Citrix version, I would still like to be able to monitor/healthcheck the XenApp 5 farms. Thank you much!

    Reply

  4. robert Nguyen Says:

    for some reason I get this error it looks like word is not saving the document

    could you shead some light on this

    WARNING: Printer driver mapping information could not be retrieved
    Unable to find type [Microsoft.Office.Interop.Word.WdSaveFormat]: make sure that the assembly containing this type is l
    oaded.
    At C:\Users\virtuosoadmin\XA5_Inventory.ps1:4681 char:73
    + $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat] <<<< , "wdFormatDocumentDefault")
    + CategoryInfo : InvalidOperation: (Microsoft.Offic…rd.WdSaveFormat:String) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

    The variable '$SaveFormat' cannot be retrieved because it has not been set.
    At C:\Users\virtuosoadmin\XA5_Inventory.ps1:4682 char:45
    + $doc.SaveAs([REF]$filename, [ref]$SaveFormat <<<< )
    + CategoryInfo : InvalidOperation: (SaveFormat:Token) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

    Reply

  5. Marius Says:

    Does this work also on PS 4.5?

    Reply

  6. Bernardo Says:

    Hi Carl,

    Fanatastic script for reporting on XenApp 5 Farms.

    I have a requierement for reporting on a few servers, which are fairly easy to get at because they are in alphabetical order, but the applications are not.
    To make a long story a very short one.
    I have to get a report about applications and the configurations, but only from a few servers.

    I have managed to modify the script to have a report with only the application reporting. What I haven’t been succesful in is instead of having the application being ordered, having the servers being ordered.

    Any ideas???

    Thanks!!!

    Reply

  7. Jared Says:

    Great script! I didn’t include the conf logging part and I still got a 841 page document about my XA 4.5 HRP 07 farm. I have one rather minor question since I am new to PowerShell, can the policies be returned in priority order instead of alphabetically?

    Reply

    • Carl Webster Says:

      I believe that is doable. Change this line:

      $Policies = Get-XAPolicy -EA 0 | sort-object PolicyName

      to

      $Policies = Get-XAPolicy -EA 0 | sort-object Priority

      Thanks

      Webster

      Reply

Leave a Reply