citrix3 Published Application WMI
| jason gilbertson | Is there a way to retrieve WFApplicationName as a user through WMI? I want to run certain portions of a vbscript based on the published application the user is coming into the server with. thanks jason jason_a_gilbertson@homedepot.com |
| Rob Seiwert | None that I found thru WMI but you can use the MFCOM. This is available after you install the MFSDK. I wrote something which just returns the current user session and I am sure application is available thru the same object.
Here is my code. function usersession() SessionState = Array(”Unknown”, _ ‘ Set theFarm = CreateObject(”MetaFrameCOM.MetaFrameFarm”) ‘ theFarm.Initialize(1) if Err.Number %26lt;%26gt; 0 Then ‘ if theFarm.WinFarmObject.IsCitrixAdministrator = 0 then ‘ buf = “MetaFrame Farm Name: ” %26#38; theFarm.FarmName %26#38; vbcrlf %26#38; vbcrlf ‘ buf = buf %26#38; “All sessions in the farm (” %26#38; Now %26#38; “)” %26#38; vbcrlf For Each aSession In theFarm.Sessions if Err.Number %26lt;%26gt; 0 Then buf = buf %26#38; padit(aSession.ServerName,10) Next end function |
| Martin Maierhofer | Jason,
WMI exposes this information, here’s part of the WMI schema: [ So you could enumerate all applications for a given session, using this class. However, just like with MFCOM, you need to be a Citrix administrator to query information, so the script would have to be run as a Citrix administrator (rather than in a login script). martin |
| Christopher King | PLEASE, one teensy, tiny snippet of code…I have searched and read all of Citrix admin guides for WMI but..
I assume if the WMI Provider is running, I should be able to ‘consume’ it using a WMI Script or at the WMIC (command line) but my problem is that nowhere can I find that first two lines. I need an Alias or in a script, I would have this: Set objWMIService = GetObject(”winmgmts:\\” %26#38; strComputer %26#38; “\root\cimv2″) So, in that case I need the WMI path. Maybe I am just stupid but all of this oblique references is making me dizzy. Please, can someone give me that first step without jumping onto step 3? Sorry to be a pain and this is really Citrix’s well-known inability to supply quite enough documentation when it comes to scripting or providers/etc. We don’t all use MOM! Thanks so much in advance-ck |
| Martin Maierhofer | Here’s a little snippet (in JScript, but that’s easily translated into VBScript — in fact the enumeration should be more natural using VBScript):
CITRIX_WMI_CONNECT = “WINMGMTS:” var objWMIService = GetObject(CITRIX_WMI_CONNECT); for(; !objZoneEnum.atEnd(); objZoneEnum.moveNext()) // … etc Hope this helps a bit. |
| Alessandro Torrisi | Martin,
could you help me how I use the MetaFrame_AppsInSession? the following code won’t work. strComputer = “.” For each session in colitems I want to know the name of the currect published application I have started. If I know this I can use this in my login script. Basicly I want to know when I start a published applucation, of this application is a real application, or if this is a published desktop. Alessandro |
| Frank Grippi | Hi Alessandro,
See code below. This is a little rough and needs some tidy up, but it should be enough to get you going. Keep in mind what was said about needing admin rights. Hope it helpes. -Frank Option Explicit Dim WshShell strComputer = “.” ‘Connect to Namespace ‘Get the users session ID ‘Open Class ‘Go through session list |



