I'm new to PowerShell and running PowerShell cmd-lets in C#. Specifically, I'm trying to use Citrix's XenDesktop SDK to write a web app to manage our XenDesktop environment.
Just as a quick test, I made a reference to the Citrix BrokerSnapIn.dll, which looks like it gives me good C# classes. However, when I hit the .Invoke with this error message: "Cmdlets derived from PSCmdlet cannot be invoked directly."
I've searched and tried a bunch of stuff, but don't know how to call PSCmdlets. I'm kinda left thinking that I have to use strings and a runspace/pipeline, etc, to do this.
Thanks In Advanced, NB
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(); } } }