I have a simple powershell monitor that pulls the active sessions from our Citrix system. What I am needing to do is pull a weekly report that gives the client the min/max/avg stat on a per day basis and in numerical form. The graph that I have figured out how to do really does nothing for you when you create a PDF file and send to client as they are unable to see the true numbers. I am pretty sure this will need to be done from SWQL but I have no knowledge of how to perform these types of queries.
try {
Add-PsSnapIn Citrix.Broker.Admin.V2;
$res=Get-BrokerSession;
}
catch {
Write-Host "Message: $($Error[0])";
exit 1;
}
if ($res -eq $null) {
Write-Host "Message.SessionState: Information not available. Possibly broker is not configured properly or no active sessions.";
Write-Host "Statistic.SessionState: -1";
exit 0;
}
$stat1=0;
$mess1="";
if ($res -is [system.array])
{
for ($i=0; $i -le $res.Count; $i++)
{
if ($res[$i].SessionState -match "Active")
{
$stat1++;
$mess1 += "<br/>";
$mess1 += $res[$i].UserName+" "+$res[$i].ClientName;
$mess1 += ";"
}
}
}
else
{
if ($res.SessionState -match "Active")
{
$stat1++;
$mess1 = $res.UserName+" "+$res.ClientName;
}
}
Write-Host "Statistic.Active: $stat1";
exit 0;