I decided to create separate document with my own list of usefull powershell commands for XenApp 6.5. I will continously update this document with command examples I use in my current projects. Feel free to posts comments if you have better solution or command syntax.

Servers

#
QFarm                     #List all servers in the XenApp farm

QFarm /online             #List all online servers

QFarm /offline            #List all offline servers

QFarm /Zone EMEA /online  #List online servers in EMEA zone
#
#List disconnected sessions
Get-XASession |Select ServerName, State, AccountName, BrowserName  |Where {$_.State -eq "Disconnected"} |Sort ServerName

#List sessions matching more than one condition
Get-XASession |Select ServerName, State, AccountName, BrowserName  |Where {$_.BrowserName -notlike "Desktop" -and $_.State -eq "Disconnected"} |Sort ServerName
#
#List configured zones in the farm
Get-XAZone

#List load for all servers in the farm
Get-XAServerLoad

#List load for all servers in EMEA zone
Get-XAServer -ZoneName EMEA |Select ServerName |Get-XAServerLoad |Sort -Desc Load

#List all servers reporting problem with license server
Get-XAServer -ZoneName EMEA |Select ServerName |Get-XAServerLoad |where {$_.Load -eq 20000 }|Sort ServerName

#List load per server using WMI query
Get-WmiObject -Namespace root\citrix -Class MetaFrame_Server_LoadLevel |Select ServerName, LoadLevel
#
#
Get-Service |where {$_.Name -match "Citrix" -or $_.DisplayName -match "citrix" } |Sort Status |Format-Table -AutoSize
#
#List all counter sets
get-counter -listset *
get-counter -listset "citrix*"

#Available Citrix counter sets:
Citrix Licensing
Citrix CPU Utilization Mgmt User
Citrix IMA Networking
Citrix MetaFrame Presentation Server
ICA Session

#List all counter names in the ICA Session counter set
(get-counter -listset "ica session").counter

#List all counter names matching specified criteria
(get-counter -listset "ica session").counter |where {$_ -match "latency" }

#Display counter value for ICA session average latency
Get-Counter -Counter "\ICA Session(*)\Latency - Session Average"
or
$1=(get-counter -listset "ica session").counter |where {$_ -match "session average" }
Get-Counter -Counter $1
#

 

Users

#
#List all sessions with status different than Listening or Connected
Get-XASession |Select SessionId, AccountName, ServerName, State |Where {$_.State -ne "Listening" -and $_.State -ne "Connected"}
or
#List all session with status Active or Disconnected
Get-XASession |Select SessionId, AccountName, ServerName, State |Where {$_.State -eq "Active" -or $_.State -eq "Disconnected"}
#
#Count all active sesions 
(Get-XASession |where {$_.State -eq "Active" }).count

#Count active session per server in particular zone
Get-XAServer -Zone EMEA |Get-XASession |Where {$_.State -eq "Active" }|Sort ServerName |Group-Object ServerName |Format-Table Name,Count -Auto

#Count all active sessions per particular server
Get-XASession -ServerName Server01 |Where {$_.State -eq "Active" }).Count
#
#Reset session
Stop-XASession -ServerName Server01 -SessionId 2
or
Get-XASession |where {$_.accountname -like "*UserABC"} |Stop-XASession 

#Disconnect session 
Disconnect-XASession -ServerName Server01 -SessionId 3 or Get-XASession |where {$_.accountname -like "*UserABC"} |Disconnect-XASession 
#
#List all processes in particular session 
Get-XASessionProcess -ServerName Server01 -SessionId 2 |select ProcessName, ProcessId

#Stop application running process 5304
Stop-XASessionProcess -ServerName xenufrdtc01 -ProcessId 5304
#

Applications

#
Get-XAWorkerGroup *EMEA* |Select WorkerGroupName |Get-XAApplication |Select DisplayName,ClientFolder,ApplicationType |Out-File -Append c:\app-group.txt
#
#
Get-XAApplicationReport -BrowserName ApplicationABC |select Accounts
#
#
Get-XASession |Select SessionId, State, BrowserName, AccountName, ServerName |Where {$_.AccountName -like "*UserABC*"}
#
#List all processes in particular session 
Get-XASessionProcess -ServerName Server01 -SessionId 2 |select ProcessName, ProcessId

#Stop application running process 5304
Stop-XASessionProcess -ServerName xenufrdtc01 -ProcessId 5304
#

Printers

#List all drivers from Server01
Get-XAPrinterDriver -SourceServerName Server01 |Select DriverName |Sort DriverName

#List all drivers matching name HP*
Get-XAPrinterDriver -ServerName Server01 |Select DriverName |Where {$_.DriverName -like "HP*"} |Sort DriverName
Get-XAPrinterDriver -ServerName Server01 |Select DriverName |Where {$_.DriverName -like "HP*v6*"} |Sort DriverName
#
#List printer drivers in the Auto-Replication-List 
Get-XAAutoReplicatedPrinterDriver

#Manual replication
Start-XAPrinterDriverReplication  "HP Universal Printing PCL 6 (v6.0.0)" -ServerName Server02,Server03

#Auto replication 
Add-XAAutoReplicatedPrinterDriver -ServerName Server01 "HP Universal Printing PCL 6 (v6.0.0)"
#

 

 

To be continued ….