- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Citrix 的 XenDesktop SDK 编写一个 Web 应用程序来管理我们的 XenDesktop 环境。
作为快速测试,我引用了 Citrix BrokerSnapIn.dll,它看起来为我提供了很好的 C# 类。但是,当我点击 .Invoke 并显示以下错误消息时:“无法直接调用从 PSCmdlet 派生的 Cmdlet。”
我搜索并尝试了很多东西,但不知道如何调用 PSCmdlet。我有点认为我必须使用字符串和运行空间/管道等来做到这一点。
using System;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Citrix.Broker.Admin.SDK;
namespace CitrixPowerShellSpike
{
class Program
{
static void Main(string[] args)
{
var c = new GetBrokerCatalogCommand {AdminAddress = "xendesktop.domain.com"};
var results = c.Invoke();
Console.WriteLine("all done");
Console.ReadLine();
}
}
}
最佳答案
您需要托管 PowerShell 引擎才能执行 PSCmdlet,例如(来自MSDN docs):
// Call the PowerShell.Create() method to create an
// empty pipeline.
PowerShell ps = PowerShell.Create();
// Call the PowerShell.AddCommand(string) method to add
// the Get-Process cmdlet to the pipeline. Do
// not include spaces before or after the cmdlet name
// because that will cause the command to fail.
ps.AddCommand("Get-Process");
Console.WriteLine("Process Id");
Console.WriteLine("----------------------------");
// Call the PowerShell.Invoke() method to run the
// commands of the pipeline.
foreach (PSObject result in ps.Invoke())
{
Console.WriteLine(
"{0,-24}{1}",
result.Members["ProcessName"].Value,
result.Members["Id"].Value);
}
}
关于c# - 在 C# 代码中运行 PSCmdLets (Citrix XenDesktop),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12712196/
我正在寻找确定我们的应用程序是否在 XenDesktop session 上而不是在本地运行。这是我到目前为止发现的: 我们目前有检测 Citrix XenApp session 的代码,类似于 He
知道 Citrix 产品是用什么语言编写的吗? (XenApp,以前的 Metaframe 和演示服务器)、XenDesktop 等?多年来我一直想知道这个问题。 最佳答案 据我所知,C,OCaml,
我正在尝试使用 Citrix 的 XenDesktop SDK 编写一个 Web 应用程序来管理我们的 XenDesktop 环境。 作为快速测试,我引用了 Citrix BrokerSnapIn.d
目前,我的公司通过 Citrix Xenapp 服务器向客户提供软件。作为管理员,我们能够启动服务器的实例,而我们的客户只能启动他们的特定应用程序 我的问题是 Windows Azure 是否也提供这
我工作的学校的标准计算机实验室设置是让学生通过 Citrix Receiver 连接到在 ESXi 主机上运行 XenDesktop 的 Windows 10 镜像。 我们想将 Android 开发添
我是一名优秀的程序员,十分优秀!