There are a few excellent scripts out there which can create an inventory report of your Citrix Farm. However, these scripts usually make use of the Citrix PowerShell snap-ins. Most of the data in Citrix Virtual Apps and Desktops (formerly known as XenApp and XenDesktop) is available through the Monitoring Service which is available on the Citrix Delivery Controllers. By using OData queries, most data can be retrieved without using any snap-ins or modules. I did some investigation and created a script which does exactly this.
I’m looking for any input and feedback on this script. So if you have any feedback or run into any problems, feel free to leave a comment or send me an email.
To download the PowerShell script I created, press the “Download Now” button:
Using the script
The script I created will create a report for XenApp / XenDesktop 7.x farms and reports the following:
- Basic Farm information
- Machine Catalogs
- Delivery Groups
The format of the report is based on the extension of the report. At this moment, the valid extensions are docx, pdf and html. When exporting a report to docx or pdf, Microsoft Word is needed on the system running the script. As all communication is done over either HTTP or HTTPS, meaning that you only need network access to one of the Delivery Controllers in the Citrix Farm.
The script is easy, you need to pass the Delivery Controller address, report Path and credentials:
PS C:\Scripts> .\Get-FarmReport.ps1 -DeliveryController MYSERVER.domain.com -Path C:\Data\FarmExport.docx -Credential (Get-Credential)
Using this command, PowerShell will prompt you for the credentials when contacting the Delivery Controller. The export will be a Microsoft Word document. Other examples for report paths are:
The script will output the progress of the data collection and report generation:
Full help is available in the script, just use “Get-Help .\Get-FarmReport.ps1” to see all parameters and examples.
The script is pretty quick in data collection. The tests that I did on a test environment only took about 3 minutes. The more applications are available in the environment, the longer script execution will take. The biggest part of script execution is the generation of the report. While HTML reports are faster to generate, the Microsoft Word version took about 6 minutes to create. The environment I tested this script in consists of about 1.500 applications and almost 100 machines. This will give you some idea on how long the script will take.
While this is the first version of the script, I’m planning to extend it with some additional features in the future:
- Export to Excel (xlsx) file
- Word template to use when creating the report
- Enable/disable certain information retrieval
If you have any feature request, remarks or challenges, please let me know in a comment or via email. Hope this script will be useful for you.
2 thoughts to “Creating a Citrix Farm inventory report without snap-ins”
I run the script and get the following error. Any suggestions?
ConvertFrom-Json : Invalid JSON primitive: .
At C:\scripts\Get-FarmReport.ps1:197 char:30
+ … ject.Data = ConvertFrom-Json $result.Content.ReadAsStringAsync().Resu …
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
Hi Floris, this is an excellent script keep up the good work.