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
cls
foreach ($server in $Servers)
{
$sessions = Get-XAServer $Server -Full
Write-Host Connections on “$server”: ($sessions).sessioncount
}
Write-Host
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!