using Citrix.Common.Sdk;
using Citrix.XenApp.Sdk;
using Citrix.XenApp.Commands;
using Citrix.Management.Automation;
I am trying to place the client address into an array to add to a list. The problem is the ClientAddress keeps coming back null when I test it. I can see the user online and their client address is visible in App Center. It has no problem coming back with the ServerName. Anybody know why ClientAddress doesn't work?
private List<string[]> findUser(string strUser)
{
List<string[]> list = new List<string[]>();
GetXASessionByFarm sessions = new GetXASessionByFarm(true);
foreach (XASession session in CitrixRunspaceFactory.DefaultRunspace.ExecuteCommand(sessions))
{
if (session.AccountName == objWINS + "\\" + strUser)
{
string[] result = new string[3];
result[0] = strUser;
result[1] = session.ServerName; //This is working, it comes back with the server name.
result[2] = session.ClientAddress; //This isn't working, it comes back blank.
MessageBox.Show(result[2]);
list.Add(result);
}
}
return list;
}
The answer to this question was to add the following line after GetXASessionByFarm is declared:
sessions.Full = true;
For example:
private List<string[]> findUser(string strUser)
{
List<string[]> list = new List<string[]>();
GetXASessionByFarm sessions = new GetXASessionByFarm(true);
sessions.Full = true;
foreach (XASession session in CitrixRunspaceFactory.DefaultRunspace.ExecuteCommand(sessions))
{
if (session.AccountName == objWINS + "\\" + strUser)
{
string[] result = new string[3];
result[0] = strUser;
result[1] = session.ServerName; //This is working, it comes back with the server name.
result[2] = session.ClientAddress; //This isn't working, it comes back blank.
MessageBox.Show(result[2]);
list.Add(result);
}
}
return list;
}
The reason for this is because the command by default does not return the full amount of information. I had to translate this and do some guesswork based on the Get-XASessions powershell command. It's always a good feeling when I figure things out by myself. Apparently I'm on the edge of the wild west frontier in this area of software development. Nobody is doing this.