Count-CitrixSession


posted by Richard Giles
02-27-2009

Downloads: 408
File size: 1.2kB
Views: 2,316

Embed
Count-CitrixSession
  1. # Count-CitrixSession.ps1 
  2. # SynJunkie 
  3. # http://synjunkie.blogspot.com/2008/12/powershell-retrieving-useful-citrix.html 
  4. # Count citrix sessions and other useful info 
  5. # Requires: Citrix Metaframe Presentation Server SDK 
  6.  
  7. $farm = new-Object -com "MetaframeCOM.MetaframeFarm" 
  8. $farm.Initialize(1) 
  9.  
  10. # displays a list of published apps and the number of users on each 
  11. write-host "Total users on each citrix application" -fore yellow 
  12. $farm.sessions | select UserName,AppName | group AppName | Sort Count -desc | select Count,Name | ft -auto 
  13. $livesessions = ($farm.Sessions).count 
  14. write-host "The number of current citrix sessions is" $livesessions -fore red 
  15.  
  16. write-host " " 
  17.  
  18. # list of citrix servers and total number of sessions on each one 
  19. write-host "Total sessions on each citrix server" -fore yellow 
  20. $farm.sessions | select ServerName,AppName | group ServerName | sort name | select Count,Name | ft -auto 
  21.  
  22. write-host " " 
  23.  
  24. # To see which users have more than one session open 
  25. write-host "First 15 Users with more than one citrix session" -fore yellow 
  26. $farm.sessions | select UserName,AppName | group UserName | Sort Count -desc | select Count,Name -first 15 | ft -auto 
Filed under: ,

Count citrix sessions and other useful info.

Attributed To: SynJunkie

URL: http://synjunkie.blogspot.com/2008/12/powershell-retrieving-useful-citrix.html

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.