Skip to main content
Background Image
  1. Blog Posts/

Locating Empty Citrix Worker Groups

·194 words·1 min

I have an environment that is currently transitioning from ~20 workergroups down to about 5. This transition includes moving to a “common” workergroup that will contain most of the users. As we transition groups we found that many of the older groups were deprecated and have no members. Rather than dig into the 50+ servers, we’ll use a little bit of powershell magic to find the answer.

Prerequisite
#

  • Citrix powershell modules.
  • Powershell v3 (not required but the customobject code is written in v3)

Code
#

Explanation
#

  • First we must get all the worker groups with Get-XAWorkerGroups
  • Then for each of those we have get all the applications with Get-XAApplications and save that as Count
  • While we’re at it we’ll also get a list of all the servers (for later clean up)

Complete Code
#

get-xaworkergroup * -ComputerName ZDCSERVER.domain | Foreach {
  [pscustomobject]@{
    Name=$_.WorkerGroupName;
    Count=$(Get-XAApplication -WorkerGroupName $_.WorkerGroupName).Count;
    Servers=$(Get-XAServers -WorkerGroupName $_.WorkerGroupName);
    }
  }

You can save that to a variable and sort it using $var | ?{ $_.Count -eq "0" }


Hopefully this helps you out. If you have any questions, feel free to contact me using the contact form linked at the top!

Gilbert Sanchez
Author
Gilbert Sanchez
Not just good. Good enough.

Related

From Terminal to TRMNL: A PowerShell Dashboard Journey
·1378 words·7 mins
It’s surprisingly easy to build your own custom dashboard with TRMNL, webhooks, and a bit of PowerShell. I used it to send dynamic data (like quotes and images) to an old device—no polling needed, just a simple POST and some fun templating.
CIDR Calculator for Alfred
·285 words·2 mins
Create a CIDR calculator for Alfred app. Complete guide to building a quick subnet calculator workflow using whatmask CLI, Alfred Powerpack, and PHP for instant network calculations.