Wanted to see if anyone else was having this problem. The build in template for Citrix (Citrix XenApp and XenDesktop 7.x (Advanced)) is returning errors that say "Index operation failed; the array index evaluated to null.". If I run the get commands they return information so I think it is something to do with the array. Has anyone else ran into this and know how to fix it? Powershell script below.
try {
Add-PsSnapIn Citrix.Broker.Admin.V2;
$res=Get-BrokerController;
}
catch {
Write-Host "Message: $($Error[0])";
exit 1;
}
if ($res -eq $null) {
Write-Host "Message.Active: Information not available. Possibly broker is not configured properly.";
Write-Host "Statistic.Active: -1";
exit 0;
}
$stat1=$stat2=$stat3=$stat4=0;
$mess1=$mess2=$mess3=$mess4="";
if ($res -is [system.array])
{
if ($res[$i].State -match "Active")
{
$stat1++;
$mess1 += "<br/>";
$mess1 += $res[$i].MachineName;
$mess1 += ";"
}
if ($res[$i].State -match "Transitioning")
{
$stat2++;
$mess2 += "<br/>";
$mess2 += $res[$i].MachineName;
$mess2 += ";"
}
if ($res[$i].State -match "Off")
{
$stat3++;
$mess3 += "<br/>";
$mess3 += $res[$i].MachineName;
$mess3 += ";"
}
if ($res[$i].State -match "Failed")
{
$stat4++;
$mess4 += "<br/>";
$mess4 += $res[$i].MachineName;
$mess4 += ";"
}
}
else
{
if ($res.State -match "Active")
{
$stat1++;
$mess1 = $res.MachineName;
}
if ($res.State -match "Transitioning")
{
$stat2++;
$mess2 = $res.MachineName;
$mess2 += ";"
}
if ($res.State -match "Off")
{
$stat3++;
$mess3 = $res.MachineName;
}
if ($res.State -match "Failed")
{
$stat4++;
$mess4 = $res.MachineName;
}
}
Write-Host "Message.Active: Controllers in Active state: $mess1";
Write-Host "Statistic.Active: $stat1";
Write-Host "Message.Transitioning: Controllers in Transitioning state: $mess2";
Write-Host "Statistic.Transitioning: $stat2";
Write-Host "Message.Off: Controllers in Off state: $mess3";
Write-Host "Statistic.Off: $stat3";
Write-Host "Message.Failed: Controllers in Failed state: $mess4";
Write-Host "Statistic.Failed: $stat4";
exit 0;