MFCOM: Farm Session Count
Another day of Citrix Administration, a simple MFCOM script to view Active Farm Sessions.
Code Snippet:
Const cMetaFrameWinFarmObject = 1
Const MFSessionStateActive = 1
Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
theFarm.Initialize(cMetaFrameWinFarmObject)
intSessionCount = 0
intActiveCount = 0
For Each oSession In theFarm.Sessions
intSessionCount = intSessionCount + 1
If (oSession.SessionState = MFSessionStateActive) and (oSession.SessionName <> "Console") Then
intActiveCount = intActiveCount + 1
WScript.Echo vbcrlf & "*****************************"
WScript.Echo "User Name: " & oSession.UserName
WScript.Echo "IP Address: " & oSession.ClientAddress
WScript.Echo "Server: " & oSession.ServerName
WScript.Echo "Application: " & oSession.AppName
WScript.Echo "Logon Time: " & oSession.ConnectedTime
End If
Next
WScript.Echo "Total Session Count = " & intSessionCount & vbcrlf & _
"Active Session Count = " & intActiveCount
If at first you fail, call it version 1.0
No comments:
Post a Comment