I'm having trouble passing an array back so I can display what I need.
if someone could possibly take the time and point out what I'm doing wrong it would be greatly appreciated.
this is designed to run on a windows box, and gather log information that I am looking to collect from select systems.
the function works if I just display all as a table, however if I try to place to an array I seem unable to pass back (or am grabbing the wrong variables).
if needed I can also post the function with the standard display if anyone needs it
thanks in advance.
<?
$computers = array( 'computername1', 'computername2', 'computername3' );
function loginfo($vComputerName, $vClass) {
$objLocator = new COM("WbemScripting.SWbemLocator");
if($vComputerName == "") $objService = $objLocator->ConnectServer();
else $objService = $objLocator->ConnectServer($vComputerName);
$objWEBM = $objService->Get($vClass);
$objProp = $objWEBM->Properties_;
$objMeth = $objWEBM->Methods_;
foreach($objMeth as $methItem)
$objWEBMCol = $objWEBM->Instances_();
foreach($objWEBMCol as $objItem) {
//if ($objItem->DriveType == 3) {
if ($_POST['type'] != "system") {
echo "<tr><td>$vComputerName</td>";
}
foreach($objProp as $propItem) {
$tmp = $propItem->Name;
if ($tmp == "Caption") {
if (strstr($objItem->$tmp, 'appevent')){
$abc[0] = "appevent";
//echo "<td>app - $appeven</td>";
}
else
if (strstr($objItem->$tmp, 'secevent')){
$abc = "secevent";
//echo "<td>sec - $secevent</td>";
} else
if (strstr($objItem->$tmp, 'sysevent')){
$abc = "sysevent";
//echo "<td>sec - $sysevent</td>";
}else
if (strstr($objItem->$tmp, 'ntds')){
$abc = "ntds";
//echo "<td>ntds - $ntds</td>";
} else
if (strstr($objItem->$tmp, 'dnsevent')){
$abc = "dnsevent";
//echo "<td>dns - $dnsevent</td>";
} else
if (strstr($objItem->$tmp, 'ntfrs')){
$abc = "ntfrs";
//echo "<td>ntfrs - $ntfrs</td>";
}
}
else
$t2 = $objItem->$tmp;
if ($t2 == null) {
$t2 = "  ";
}
if ($tmp == "NumberOfRecords") {
$def[$counter5] = $t2;
}
$counter5 ++;
}
}
return ($def) ;
}
echo "<BR><table width=550 border=1><tr><td>Computer Name</td><td>App Log</td><td>Sec Log</td><td>Sys Log</td><td>Dir. Serv. Log</td><td>DNS Log</td><td>File Rep. Log</td></tr>";
foreach ($computers as $cname) {
loginfo($cname, $linfo) ;
echo "<td>$def[0]</td><td>$def[1]</td><td>$def[2]</td><td>$def[3]</td><td>$def[4]</td><td>$def[5]</td></tr>";
}
echo "</table>";
?>