The Return of Citrix QFarm

Here is another awesome utility brought to you by Jacques Bensimon. This one is a wrapper to reproduce the old familiar QFarm functionality you might be missing with newer Citrix upgrades.


When Citrix XenApp 6.5 gave way to XenDesktop (now CVAD) 7.x all those years ago, one of the immediate victims was the trusty QFarm.exe command-line utility, a stalwart component of many Citrix-related scripts, utilities, and yes, even DOSKEY macros, in my and others’ arsenal of management tools. 

Sure, similar farm/site query capabilities were now provided via the “Get-Broker…PowerShell cmdlets, but using them with existing tools implied major rewrites, if not a wholesale scripting platform change.  It therefore seemed easier to create a drop-in QFarm replacement supporting the most commonly used QFarm switches (/Online, /Offline, /Load, and plain QFarm without a switch).  It was also important that the new QFarm output the same number of (equivalent) columns, title rows, and blank lines as the original for each switch, and that it not require new additional parameters to specify the Delivery Controller to query, and the machine catalog or delivery group or VDA type (multi-session/single-session) on which to report.  To this end, although the new QFarm attempts to automatically determine these “target items”, it allows them to be pre-specified via environment variables, as explained in this screenshot:

Note that “online/offline” are to be interpreted as “registered/unregistered”.  Note also that, as described in the syntax help, a new separate /Custom switch allows displaying any machine properties available via the Get-BrokerMachine cmdlet, including using /Custom * to get them all (but you’d best be redirecting the output to a file in that case, a reasonably handy way to capture a list of all the available property names, if nothing else).

Well, with QFarm out of the way and now drunk with power 😉, I thought a companion utility that exercises some of the other Get-Broker… cmdlets to report on different types of site object (including the site itself) could come in handy, so the download also contains QSite.exe, described in the next screenshot:

With its customizable output and filtering capability, QSite can actually reproduce all the QFarm capabilities.  For example,

QFarm /Online  ≌  QSite /Machines InMaintenanceMode “-RegistrationState Registered”

IMPORTANT:  As should be clear by now, QFarm & QSite are essentially specialized wrappers for various Citrix PowerShell cmdlets, so in order to use them on anything other than Delivery Controllers (typically but not necessarily VDAs), the cmdlets in question need to be made available.  This can be achieved in two ways:  the minimal approach is to install the Citrix Broker PowerShell Snap-in (Broker_PowerShellSnapIn_x64.msi from folder “\x64\Citrix Desktop Delivery Controller” in the CVAD ISO), or you can install Citrix Studio which includes that and several other snap-ins, if you have a use for Studio outside of DDCs.

Since you’ve read this far, I’ll reward you with an additional “secret switch” supported by both QFarm and QSite/QTest serves two purposes:  1) it’ll display the (automatically determined or explicitly specified) DDC, machine catalog, deployment group, and/or VDA type (or just the DDC in the case of QSite) that will be used in subsequent runs of the utilities, and 2) since its output is artificially made to go through PowerShell, it’ll confirm that there are no issues using and interfacing with PowerShell on your machine.  If /QTest is successful, any PowerShell errors when using the other switches (which will be displayed at the console as they would be in PowerShell) will likely be due to missing Citrix cmdlets, invalid syntax, unresponsive DDC, etc., i.e. not PowerShell issues per se.

I hope you’ll find these utilities useful and that they’ll help revive some of your own “legacy” management tools.
JB

Follow Jacques Bensimon on Twitter @JacqBens for more great Windows insights and tricks.

TAGS