mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 06:54:58 +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 wbemFlagForwardOnly = 0x20;
|
||||
|
||||
this.server = ".";
|
||||
this.interface = null;
|
||||
this.cursor = {};
|
||||
this.current = {};
|
||||
|
||||
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;
|
||||
};
|
||||
this.execQuery = function(query) {
|
||||
try {
|
||||
var result = this.interface.ExecQuery(query, "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly);
|
||||
this.cursor = new Enumerator(result);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue
Block a user