Showing posts with label MFCOM. Show all posts
Showing posts with label MFCOM. Show all posts

Friday, July 13, 2007

MFCOM: Farm Session Count

Another day of Citrix Administration, a simple MFCOM script to view Active Farm Sessions.

Code Snippet:

  1. Const cMetaFrameWinFarmObject = 1
  2. Const MFSessionStateActive = 1
  3. Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
  4. theFarm.Initialize(cMetaFrameWinFarmObject)
  5. intSessionCount = 0
  6. intActiveCount = 0
  7. For Each oSession In theFarm.Sessions
  8. intSessionCount = intSessionCount + 1
  9. If (oSession.SessionState = MFSessionStateActive) and (oSession.SessionName <> "Console") Then
  10. intActiveCount = intActiveCount + 1
  11. WScript.Echo vbcrlf & "*****************************"
  12. WScript.Echo "User Name: " & oSession.UserName
  13. WScript.Echo "IP Address: " & oSession.ClientAddress
  14. WScript.Echo "Server: " & oSession.ServerName
  15. WScript.Echo "Application: " & oSession.AppName
  16. WScript.Echo "Logon Time: " & oSession.ConnectedTime
  17. End If
  18. Next
  19. WScript.Echo "Total Session Count = " & intSessionCount & vbcrlf & _
  20. "Active Session Count = " & intActiveCount


If at first you fail, call it version 1.0

MFCOM: Connection licenses and usage count

Yet Another Citrix Administrator Task, monitor the connection licenses and usage count in the farm...

Feel like a hill billy...

Code Snippet:

  1. Dim fso
  2. Set fso = CreateObject("Scripting.FileSystemObject")
  3. If not fso.FolderExists("c:\liclog" ) then
  4. Set MyFolder = fso.createFolder("c:\liclog" )
  5. else
  6. End if
  7. if not fso.FileExists("c:\liclog\licCount.log" ) then
  8. Set MyFile= fso.createTextFile("c:\liclog\licCount.log")
  9. MyFile.writeline "Date " & " Time " & "Lic Type " & "Used"
  10. MyFile.close
  11. else
  12. end if
  13. Const ForAppending = 8
  14. Set MyFile= fso.OpenTextFile("c:\liclog\licCount.log", ForAppending,True)
  15. Dim theFarm, aLicense
  16. Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
  17. ' Initialize the farm object.
  18. theFarm.Initialize(MetaFrameWinFarmObject)
  19. For Each aLicense In theFarm.LicenseSets(MFLIcenseClassConnection)
  20. if aLicense.LicenseID = "0000000000000003" then
  21. MyFile.WriteLine date & "," & time & "," & aLicense.Name &amp;amp; "," & aLicense.pooledinuse("")
  22. else
  23. end if
  24. next
  25. MyFile.Close


If at first you fail, call it version 1.0