logo
parallax-small

XA 6.5 Farm Overview Script

Tuesday, 05 August 2014

By Benjamin Ruoff

I'm often asked by customers, if there is a simple way to get a farm usage report which displays the amount of active and disconnected users over a week, month etc.

In the past I said, "yes" I have a little PowerShell Script which will query the farm, calculate the effective active and disconnected users and write the output into a SQL table (Timestamp, Active Users, and Disconnected Users). With e.g. Excel you can connect to the SQL database and generate very easy a table and chart about the user sessions. 

A few months later, an enhancement request arrived me. A customer told me, that he wants a farm report like the first PowerShell script but the user Sessions should be displayed per server and per published application.

I decided to write a new script with the ability to report the active and disconnected sessions per server and per published application in the console per default. In addition I added the ability for SQL logging by script argument.

Script runtime requirements:
•    the name of the XenApp Zone Data Collector
•    Installed XenApp PowerShell Commands.
•    The User which executes the Script needs the Rights to query the Farm.
•    The Zone Data Collector must have WMI remoting enabled.

Script Header

If the requirements are met, the script runs and generate a console output. Per default, the display will refreshed every 5 minutes. Only servers or published applications with either active and/or disconnected users sessions appear in the command window.

To keep the data for historical reporting, the script can write the values into a SQL database.

SQL logging requirements are:
•    one database on a Microsoft SQL Server
•    two tables with the name “Applications” and “Servers”
•    The Script have to run with the “-SQL” Switch (ActiveUsers_v2.1.ps1 -SQL)
•    The variables “$DBServer” and “$DBDatabase” have to be specified
•    The user which executes the Script need the permission to write into the database

The Table Applications need the following Columns:

Application Columns

The Table Servers need the following Columns:

Servers Columns

In my example, I used the “Pivot Table and Graph Feature” of Microsoft Excel for reporting. I connected the SQL database and selected the fields as in the screenshot. I grouped the DateTime field so that I can easily expand an collapse months or days (very useful if its running for months).

Table ApplicationsPNG

Graph Applications

Table Servers

Graph Servers

The script can be downloaded from our Download section.

Comments (6)

  • Martin Fischer

    Martin Fischer

    05 September 2014 at 11:24 |
    Hello, should this script also work with XenApp 6.0 and if not what must be updated ?

    reply

    • Benjamin Ruoff

      Benjamin Ruoff

      08 September 2014 at 08:43 |
      Hi Martin,

      yes, this Script should also work on a XenApp 6.0 Farm. It is bases on the XenApp Powershell SDK.

      reply

  • danny

    danny

    21 October 2014 at 16:20 |
    Nice Script, love it

    reply

  • van hauwermeiren steven

    van hauwermeiren steven

    11 June 2015 at 10:21 |
    Hi,
    Nice script!
    I downloaded it, it seems to work fine, once. If I run the script, at the end it displays: cmdlet Write-Progress at command pipeline position 1

    Can you help me?
    Thanks,
    Steven

    reply

    • Benjamin Ruoff

      Benjamin Ruoff

      01 July 2015 at 11:52 |
      The Scripts runs and processes a complete loop. After that it sleeps as Long as the configured Intervall (300 Seconds in Default) before starting the next query. if you have further questions just send me an email with an screenshot. Regards, benjamin

      reply

  • tulika

    tulika

    28 September 2016 at 03:20 |
    script looks cool.

    reply

Leave a comment

You are commenting as guest.