wmi.js

/*! $FileVersion=1.0.127 */ var wmi_fileVersion = “1.0.127”;
function CreateWMIManger(){var a={_createAttribute:function(f,c){var g={_data:[],get:function(l,j){try{return l(this._data,j)}catch(k){return null}}};try{f.reset();var d=f.next();while(d){var h=d.get(c);g._data.push(h);d=f.next()}}catch(i){logDebug(“failed to populate attribute object”)}return g},_createClassIterator:function b(d,e){var c={getAttribute:function(f){try{return this.attributeFactory(this._iterator,f)}catch(g){logDebug(“_createClassIterator failed”);return{get:function(){return null}}}},attributeFactory:e,_iterator:d};return c},getPlugin:function(){if(!this.wmiPlugin){this.wmiPlugin=getPluginFactory().Create(“wmi”)}return this.wmiPlugin},getClassIterator:function(c){var e=this.getPlugin().connectServer(“\\.\Root\CIMV2”);var d=e.execQuery(“SELECT * FROM “+c);return this._createClassIterator(d,this._createAttribute)},wmiPlugin:null,preprocessors:{noop:function(c){return c},toInt:function(c){return parseInt(c)}},aggregators:{useFirst:function(c,d){try{return d(c[0])}catch(f){return null}},summation:function(c,d){try{var g=0;for(var f in c){g+=d(c[f])}return g}catch(h){return 0}},count:function(c,d){try{return c.length}catch(f){return 0}}},loadFromDataDefinition:function(c,i){try{logDebug(“loadFromDataDefinition”);for(var h in i){logDebug(“loading classname: “+h);var n=i[h];for(var l in n){var g=this.getClassIterator(h);logDebug(“loading attributeName: “+l);var f=g.getAttribute(l);var m=n[l];for(var k in m){var d=this.aggregators[m[k].aggregatorName];if(!d){d=this.aggregators.useFirst}var p=this.preprocessors[m[k].preprocessorName];if(!p){p=this.preprocessors.noop}var o=f.get(d,p);logDebug(k+”: “+o);c.set(k,o,m[k].ruleConfig)}}}logDebug(“loadFromDataDefinition finished”)}catch(j){logDebug(“loadFromDataDefinition failed: “+j.message)}}};return a}ModuleManager.registerFactory(“wmi”,CreateWMIManger);