Counting Number of Sessions on Citrix servers

My Pl give me a tsk to count the number of sessions on citrix servers every 5 or 10 minutes

The below vb script that I found on some forum can assist in it it, it uses COM object to get desired result & can be scheduled thru scheduled task

Dim Sessions
set theFarm = CreateObject(“MetaFrameCOM.MetaFrameFarm”)
theFarm.Initialize(1)

Set servers = thefarm.servers

For Each aserver In servers
count = 0
‘WScript.Echo aserver.servername
sessioninfo aserver.servername
Next

function sessioninfo (strServer)
For Each aSession In theFarm.Sessions
If aSession.servername = strServer Then
count = count+1
End If
next
WScript.Echo strServer & ” : ” & count
End Function

Also I have modified it a bit to take input from a file so that if we want sessions connected to particualr servers we can find that:

Dim Sessions
set theFarm = CreateObject(“MetaFrameCOM.MetaFrameFarm”)
theFarm.Initialize(1)

Set servers = thefarm.servers

Dim fso
Set fso = WScript.CreateObject(“Scripting.Filesystemobject”)
Set readfile = fso.OpenTextFile(“c:\citrix.txt”,1)
Do While not readfile.AtEndOfStream
count = 0
strServer = readfile.ReadLine
sessioninfo strServer
loop
readfile.Close

function sessioninfo (strServer)
For Each aSession In theFarm.Sessions
If aSession.servername = strServer Then
count = count+1
End If
next
WScript.Echo strServer & ” : ” & count
End Function

Advertisement

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s