Richard Parmiter

Virtualisation blog and Knowledge Base

  • You are here: 
  • Home
  • MFCOM script to export the current users of an application

MFCOM script to export the current users of an application

Posted on April 27th, 2009

Sometimes is is necessary to have a list of users in a text file of which other scripts can be run. In this case I wanted a list of all users currently logged into a specific Citrix application in order to perform some other task.

The following MFCOM script will export all the users currently logged into a specified application and export them to a text file.

Set objFarm = CreateObject(“MetaFrameCOM.MetaFrameFarm”)

Dim ObjFSO, Objuserlist
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set Objuserlist = objFSO.OpenTextFile(“c:\windows\temp\userlist.log”, 8, True)

objFarm.Initialize(1)

For Each objSession In objfarm.Sessions

if objsession.appname = (“My Application Name”) then
objuserlist.WriteLine(objSession.UserName)
End IF
Next

WScript.Echo “userlist created here – c:\windows\temp\userlist.log”

Substitute “My Application name” and the log file location as appropriate.

Save this as a .vbs file and run.

  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Add to favorites
  • FriendFeed
  • Google Buzz
  • LinkedIn
  • Live
  • MySpace
  • Reddit
  • RSS

Tags: , , , , , , ,
Filed under Scripts/Reg |

2 Responses to “MFCOM script to export the current users of an application”

  1. Jason Says:
    September 10th, 2009 at 1:43 pm

    Very interesting to read it

  2. julian Says:
    February 17th, 2014 at 6:44 pm

    THank you very much . Works great !!

Leave a Reply

*