如何在 Citrix XenApp 6.0 上获取唯一的客户端 ID? (4.0 和 4.5 中的 MFCom 不起作用)

发布于 2024-11-11 18:12:36 字数 583 浏览 3 评论 0 原文

目前,对于Presentation Server 4.0 和4.5,我通过C# .NET 中的MFCom 获取唯一的客户端ID。

MetaFrameFarm farm = new MetaFrameFarm();
farm.Initialize(MetaFrameObjectType.MetaFrameWinFarmObject);

foreach (MetaFrameSession session in farm.Sessions)
{
    clientId = session.ClientID;
.....

我开始在6.0上进行测试时出现错误。失败的问题行是实例化上面的对象“farm”的第一行。

在网上查了一下,我发现了这个...

从 XenApp 6.0 开始,MFCOM 作为 公共支持的节目和 脚本接口将不再是 可用的。所有现有的基于 MFCOM 的 代码不再适用于 XenApp 6.0。不 怀疑 MFCOM 的缺席是否会 是需要额外的东西 努力采用 XenApp 6.0。

有没有办法在 6.0 中获得唯一的客户端 ID?

Currently for Presentation Server 4.0 and 4.5, I am getting the unique client ID via MFCom in C# .NET.

MetaFrameFarm farm = new MetaFrameFarm();
farm.Initialize(MetaFrameObjectType.MetaFrameWinFarmObject);

foreach (MetaFrameSession session in farm.Sessions)
{
    clientId = session.ClientID;
.....

I began to get an error testing on 6.0. The line in question that is failing is the first line to instantiate a the object 'farm' above.

Looking online I found this...

Starting in XenApp 6.0, MFCOM as a
publically supported programming and
scripting interface will no longer be
available. All existing MFCOM-based
code no longer works on XenApp 6.0. No
doubt that the absence of MFCOM will
be something that requires additional
effort to the adoption of XenApp 6.0.

Is there a way to get a unique client ID in 6.0?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦里泪两行 2024-11-18 18:12:36

这已经很老了,但当我想获取 clientID 时,我一直遇到这个问题。

请记住,4.X 中的 ClientID 似乎与 6.X 中的格式不同。这适用于所有 ID、应用程序和服务器:

Runspace rs = RunspaceFactory.CreateRunspace();
rs.Open();

PowerShell ps = PowerShell.Create();
ps.Runspace = rs;

PSSnapInException ex;
rs.RunspaceConfiguration.AddPSSnapIn("Citrix.XenApp.Commands", out ex);

ps.AddCommand("GET-XASession").AddParameter("Full");

foreach (PSObject Session in ps.Invoke())
{
   try
   {
      ClientID = Convert.ToString(Session.Properties["ClientId"].Value);

      Console.WrileLine(ClientID);

   }

   catch (Exception e)
   {
      WriteError.WriteEntry("Client Failure " + e.Message + EventLogEntryType.FailureAudit);
   }
}

This is pretty old, but I kept coming across this when I wanted to get a clientID.

Keep in mind the ClientIDs from 4.X don't appear to be the same format for 6.X. This goes for about all the IDs, App and Server:

Runspace rs = RunspaceFactory.CreateRunspace();
rs.Open();

PowerShell ps = PowerShell.Create();
ps.Runspace = rs;

PSSnapInException ex;
rs.RunspaceConfiguration.AddPSSnapIn("Citrix.XenApp.Commands", out ex);

ps.AddCommand("GET-XASession").AddParameter("Full");

foreach (PSObject Session in ps.Invoke())
{
   try
   {
      ClientID = Convert.ToString(Session.Properties["ClientId"].Value);

      Console.WrileLine(ClientID);

   }

   catch (Exception e)
   {
      WriteError.WriteEntry("Client Failure " + e.Message + EventLogEntryType.FailureAudit);
   }
}
满栀 2024-11-18 18:12:36

正如您所正确确定的,MFCOM 在 XenApp 6 上不可用。因此,您有两种获取唯一 ClientID 的方法:

  1. 使用 Citrix WMI 子系统。从应用程序内连接到Root\Citrix WMI 命名空间并枚举 MetaFrame_Session 类的实例。您可以按服务器名称(因为枚举将返回所有场服务器上的所有会话,而不仅仅是您正在运行应用程序的服务器)和会话 ID 进行过滤。 Metaframe_session 类的实例包含几个属性,它们是对其他类实例的引用; Client 属性引用 Metaframe_ICA_Client,SessionUser 属性引用 Citrix_User。 Metaframe_ICA_Client 为您提供客户端的 IP 地址、主机名和一些其他可以组合为 ID 的内容。
    但是,当前 XenApp 6 在 Citrix WMI 子系统方面存在巨大错误,并试图枚举和实例化​​我引用的类上面(作为普通用户 - 管理员没问题)会导致不少于 15 个单独的系统服务崩溃......所以也许不会。
  2. 另一种方法(也是我采用的技术)是使用 Citrix WFAPI SDK。它是非托管代码,有点笨,但有一篇关于使用 WFAPI 获取客户端详细信息的相当好的文章 此处

As you've correctly established, MFCOM is not available on XenApp 6. So, you're left with two ways of getting a unique ClientID:

  1. Use the Citrix WMI subsystem. From within your application, connect to the Root\Citrix WMI namespace and enumerate instances of the MetaFrame_Session class. You can filter by server name (as the enumeration will return all sessions on all farm servers, not just the one you're running the application on) and session ID. The instances of the Metaframe_session class contain a couple of properties which are references to instances of other classes; the Client property references Metaframe_ICA_Client and the SessionUser property references Citrix_User. Metaframe_ICA_Client gives you the client's IP address, hostname and a few other things you could combine as an ID.
    However, currently XenApp 6 has a massive bug with the Citrix WMI subsystem and attempting to enumerate and instantiate the classes I've references above (as a normal user - admins are fine) results in no less than fifteen separate system services crashing... So maybe not.
  2. The alternative (and the technique I employed) was to use the Citrix WFAPI SDK. It's unmanaged code and a bit of a pig, but there's a pretty good article on using WFAPI to grab client details here.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文