mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 05:01:03 +00:00
Update wmi.js
This commit is contained in:
parent
c60e3b157f
commit
1167c6ab84
|
@ -6,19 +6,24 @@ var WMIObject = function() {
|
||||||
var wbemFlagReturnImmediately = 0x10;
|
var wbemFlagReturnImmediately = 0x10;
|
||||||
var wbemFlagForwardOnly = 0x20;
|
var wbemFlagForwardOnly = 0x20;
|
||||||
|
|
||||||
|
this.server = ".";
|
||||||
this.interface = null;
|
this.interface = null;
|
||||||
this.cursor = {};
|
this.cursor = {};
|
||||||
this.current = {};
|
this.current = {};
|
||||||
|
|
||||||
this.create = function() {
|
this.create = function() {
|
||||||
this.interface = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2");
|
this.interface = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\" + this.server + "\\root\\cimv2");
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
this.setServer = function(server) {
|
||||||
|
this.server = server;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
this.execQuery = function(query) {
|
this.execQuery = function(query) {
|
||||||
try {
|
try {
|
||||||
var result = this.interface.ExecQuery(query, "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly);
|
var result = this.interface.ExecQuery(query, "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly);
|
||||||
this.cursor = new Enumerator(result);
|
this.cursor = new Enumerator(result);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
console.error(e.message);
|
console.error(e.message);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user