public static function getWMI($wmi, $strClass, $strValue = array())
    {
        $arrData = array();
        if ($wmi) {
            $value = "";
            try {
                $objWEBM = $wmi->Get($strClass);
                $arrProp = $objWEBM->Properties_;
                $arrWEBMCol = $objWEBM->Instances_();
                foreach ($arrWEBMCol as $objItem) {
                    if (is_array($arrProp)) {
                        reset($arrProp);
                    }
                    $arrInstance = array();
                    foreach ($arrProp as $propItem) {
                        $value = $objItem->{$propItem->Name}; //instead exploitable eval("\$value = \$objItem->".$propItem->Name.";");
                        if (empty($strValue)) {
                            if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
                            else $arrInstance[$propItem->Name] = $value;
                        } else {
                            if (in_array($propItem->Name, $strValue)) {
                                if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
                                else $arrInstance[$propItem->Name] = $value;
                            }
                        }
                    }
                    $arrData[] = $arrInstance;
                }
            } catch (Exception $e) {
                if (PSI_DEBUG) {
                    $error = PSI_Error::singleton();
                    $error->addError($e->getCode(),preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage())));
                }
            }
        }

        return $arrData;
    }
public static function getWMI($wmi, $strClass, $strValue = array())
    {
        $arrData = array();
        if ($wmi) {
            $value = "";
            try {
                $objWEBM = $wmi->Get($strClass);
                $arrProp = $objWEBM->Properties_;
                $arrWEBMCol = $objWEBM->Instances_();
                foreach ($arrWEBMCol as $objItem) {
                    if (is_array($arrProp)) {
                        reset($arrProp);
                    }
                    $arrInstance = array();
                    foreach ($arrProp as $propItem) {
                        $value = $objItem->{$propItem->Name}; //instead exploitable eval("\$value = \$objItem->".$propItem->Name.";");
                        if (empty($strValue)) {
                            if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
                            else $arrInstance[$propItem->Name] = $value;
                        } else {
                            if (in_array($propItem->Name, $strValue)) {
                                if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
                                else $arrInstance[$propItem->Name] = $value;
                            }
                        }
                    }
                    $arrData[] = $arrInstance;
                }
            } catch (Exception $e) {
                if (PSI_DEBUG) {
                    $error = PSI_Error::singleton();
                    $error->addError($e->getCode(),preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage())));
                }
            }
        }

        return $arrData;
    }
public static function getWMI ( $ wmi , $ strClass , $ strValue = array ( ) ) { $ arrData = array ( ) ; if ( $ wmi ) { $ value = "" ; try { $ objWEBM = $ wmi -> Get ( $ strClass ) ; $ arrProp = $ objWEBM -> Properties_ ; $ arrWEBMCol = $ objWEBM -> Instances_ ( ) ; foreach ( $ arrWEBMCol as $ objItem ) { if ( is_array ( $ arrProp ) ) { reset ( $ arrProp ) ; } $ arrInstance = array ( ) ; foreach ( $ arrProp as $ propItem ) { $ value = $ objItem -> { $ propItem -> Name } ; //instead exploitable eval("\$value = \$objItem->".$propItem->Name.";"); if ( empty ( $ strValue ) ) { if ( is_string ( $ value ) ) $ arrInstance [ $ propItem -> Name ] = trim ( $ value ) ; else $ arrInstance [ $ propItem -> Name ] = $ value ; } else { if ( in_array ( $ propItem -> Name , $ strValue ) ) { if ( is_string ( $ value ) ) $ arrInstance [ $ propItem -> Name ] = trim ( $ value ) ; else $ arrInstance [ $ propItem -> Name ] = $ value ; } } } $ arrData [ ] = $ arrInstance ; } } catch ( Exception $ e ) { if ( PSI_DEBUG ) { $ error = PSI_Error :: singleton ( ) ; $ error -> addError ( $ e -> getCode ( ) , preg_replace ( '/<br\/>/' , "\n" , preg_replace ( '/<b>|<\/b>/' , '' , $ e -> getMessage ( ) ) ) ) ; } } } return $ arrData ; }
function for getting a list of values in the specified context
optionally filter this list, based on the list from third parameter

@param $wmi object holds the COM object that we pull the WMI data from
@param string $strClass name of the class where the values are stored
@param array  $strValue filter out only needed values, if not set all values of the class are returned

@return array content of the class stored in an array
function for getting a list of values in the specified context optionally filter this list based on the list from third parameter