title: Citrix 7.6 Broker SDK C#/Powershell
body: <p>Has anyone worked with the Citrix 7.6 BrokerSession SDK? I can't figure out how to execute a command like this for example:</p>
  
  <pre><code>GetBrokerSessionCommand getCmd = new GetBrokerSessionCommand();
  getCmd.AdminAddress = "citrixServer:80";
  var result = getCmd.Invoke();
  </code></pre>
  
  <p>This gives me an error message saying: "Cmdlets derived from PSCmdlet cannot be invoked directly.</p>
  
  <p>In the earlier 6.5 SDK I could do like this:</p>
  
  <pre><code>string[] servers = new string[] { };
  GetXAWorkerGroupByName workerGroup = new GetXAWorkerGroupByName();
  workerGroup.WorkerGroupName = new string[] { workerGroupName };
  workerGroup.ComputerName = XenAppController;
  foreach (XAWorkerGroup _workerGroup in CitrixRunspaceFactory.DefaultRunspace.ExecuteCommand(workerGroup))
                  {
                      servers = _workerGroup.ServerNames;
                  }
  
              return servers;
  </code></pre>
  
  <p>But now the CitrixRunspaceFactory no longer exists? 
  I want to avoid executing the command with the Powershell class and Powershell.Create() for the simple reason of handling exceptions in a simpler way.</p>