Find out who is using your XenApp Published Applications

Here is a quick bit of PowerShell code to list out users logged into a specific application of your choice. This works with XenApp 6.0, but would also work with newer versions :

Add-PSSnapin citrix*
Get-XASession -BrowserName ‘Application Name’ | Select AccountName, ServerName

This will list out Active and Disconnected sessions

Alternatively, here is a piece of code that will list out the number of sessions that are logged in for two applications that are published onto servers in the same XenApp WorkerGroup:

Add-PSSnapin citrix*
$App1 = (Get-XASession -BrowserName ‘Application 1’ | Select AccountName, ServerName).count
$App2 = (Get-XASession -BrowserName ‘Application 2’ | Select AccountName, ServerName).count
$Servers = Get-XAServer -WorkerGroupName “WorkerGroupName” | sort servername
foreach ($server in $Servers)
$sessions = Get-XAServer $Server -Full
Write-Host Connections on “$server”: ($sessions).sessioncount

Write-Host Application 1 Connections: $App1
Write-Host Application 2 Connections: $App2

The output looks like this:

Connections on DESK33 : 4
Connections on DESK34 : 7
Connections on DESK35 : 7
Connections on DESK36 : 7
Connections on DESK37 : 8
Connections on DESK38 : 8

Application 1 Connections: 276
Application 2 Connections: 217

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: