0

I am trying to build an application for Citrix users to end their own session. I originally coded this myself, but then I found this post:

C# How do I log off a Citrix XenApp User Session?

But I am unable to emulate it. When I add the using Citrix; references, I am seeing "The type or namespace could not be found."

Do I need to install something for this? I have searched the internet for this, but all I could find was a download for what is apparently the XenServer-SDK (is this correct?)

Even then, I added the .dlls in Visual Studio, and references like so:

 using CookComputing;
 using XenServer;

However, I am seeing the same message for these (they are not recognised by Visual Studio).

My original solution does work, but I think I may be able to program a much cleaner solution by using APIs.

Please can someone point me in the right direction? Any help on this is much appreciated!

Many thanks

Community
  • 1
  • 1
Bassie
  • 9,529
  • 8
  • 68
  • 159

1 Answers1

1

If you need to stop XenApp session, then you need XenApp SDK (not XenServer). You can download SDK from Citrix site.

Then in your project add references to dlls located in %ProgramFiles%\Citrix\XenApp Server SDK\bin (for XenApp 6.0):

  • Citrix.Management.Automation.dll
  • Citrix.XenApp.Sdk.dll
  • other dlls depending on what you will use

And then add using directives to your .cs file:

using Citrix.Common.Sdk;
using Citrix.XenApp.Sdk;
using Citrix.XenApp.Commands;
using Citrix.Management.Automation;
Mikhail Tumashenko
  • 1,683
  • 2
  • 21
  • 28
  • Hi Mikhail, many thanks for your response - this was extremely helpful and I feel I now understand a bit more about reference dlls and using directives. I have been able to accomplish what I need using the regular windows CMD command terminal, but this is not ideal due to the terminal flashing up for a second in some instances. When I try logging off users using your above suggestion, I am seeing this error: Citrix commands must be executed at the Citrix server or using remoting. Assuming I am missing some security setting which is required for remote control. Thanks again! – Bassie Nov 16 '15 at 10:11
  • As a message says, you have two choices: create local Powershell Runspace and use Citrix Remoting (Citrix supports it's own remoting), or create Powershell Runspace remotely on Citrix XenApp server and run local commands (local on that server). I haven't tried this, so you better try yourself and open a new question if you'll got stuck with it. – Mikhail Tumashenko Nov 16 '15 at 13:57