#!/usr/bin/php -q 5) { // if the number of arguments isnt above 5 then don't bother with the where = etc $condition_key = $argv[5]; $condition_val = escapeshellarg($argv[6]); } else { $condition_key = null; }; // globals $wmiexe = '/usr/local/bin/wmic'; // executable for the wmic command $output = null; // by default the output is null $wmiquery = 'SELECT '.$columns.' FROM '.$wmiclass; // basic query built if ($condition_key != null) { $wmiquery = $wmiquery.' WHERE '.$condition_key.'='.$condition_val; // if the query has a filter argument add it in }; $wmiquery = '"'.$wmiquery.'"'; // encapsulate the query in " " $wmiexec = $wmiexe.' -U '.$user.'%'.$pass.' //'.$host.' '.$wmiquery; // setup the query to be run //echo "\n\n".$wmiexec."\n\n"; // debug :) exec($wmiexec,$wmiout); // execute the query if (count($wmiout) > 0) { $names = explode('|',$wmiout[1]); // build the names list to dymanically output it for($i=2;$i